12345678910111213 |
- import os
- # Define the root directory
- root_dir = "geoip/"
- # Loop through all subdirectories in the root directory
- for subdir in os.listdir(root_dir):
- subdir_path = os.path.join(root_dir, subdir)
-
- # Check if the subdirectory contains any txt files
- if not any(fname.endswith(".txt") for fname in os.listdir(subdir_path)):
- # If not, remove the subdirectory
- os.rmdir(subdir_path)
|