| import os | |
| # Specify the directory to check | |
| directory = "val/" | |
| # Initialize counter for empty files | |
| empty_file_count = 0 | |
| # Loop through all files in the directory | |
| for filename in os.listdir(directory): | |
| file_path = os.path.join(directory, filename) | |
| # print(file_path) | |
| # Check if it's a file (not a directory) | |
| if os.path.isfile(file_path) and not ('bg' in file_path or 'paper_aug' in file_path): | |
| # Get file size in bytes | |
| file_size = os.path.getsize(file_path) | |
| if file_size == 0: | |
| print(f"Empty file found: {filename}") | |
| empty_file_count += 1 | |
| # Print the total count of empty files | |
| print(f"Total number of empty files: {empty_file_count}") | |