Guest User

Kill XWMs

a guest
Apr 15th, 2024
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.65 KB | None | 0 0
  1. import os
  2.  
  3. def remove_wav_files(directory_path):
  4.     """
  5.    Removes all WAV files in the specified directory and its subdirectories.
  6.  
  7.    Args:
  8.        directory_path (str): The root directory path.
  9.  
  10.    Returns:
  11.        None
  12.    """
  13.     for root, _, files in os.walk(directory_path):
  14.         for filename in files:
  15.             if filename.lower().endswith('.xwm'):
  16.                 file_path = os.path.join(root, filename)
  17.                 os.remove(file_path)
  18.                 print(f"Removed: {file_path}")
  19.  
  20. if __name__ == "__main__":
  21.     script_directory = os.path.dirname(os.path.abspath(__file__))
  22.     remove_wav_files(script_directory)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment