Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def remove_wav_files(directory_path):
- """
- Removes all WAV files in the specified directory and its subdirectories.
- Args:
- directory_path (str): The root directory path.
- Returns:
- None
- """
- for root, _, files in os.walk(directory_path):
- for filename in files:
- if filename.lower().endswith('.wav'):
- file_path = os.path.join(root, filename)
- os.remove(file_path)
- print(f"Removed: {file_path}")
- if __name__ == "__main__":
- script_directory = os.path.dirname(os.path.abspath(__file__))
- remove_wav_files(script_directory)
Advertisement
Add Comment
Please, Sign In to add comment