To find and remove files by extension in a directory and its subdirectories on Linux, you can use the command: find /path/to/dir -name "*.extension" -type f -delete, replacing /path/to/dir with your directory path and *.extension with the specific file extension you want to delete. For example, to remove all .txt files, use find /path/to/dir -name "*.txt" -type f -delete.
Created
January 12, 2026 21:24
-
-
Save kekneus373/379c263265b01c69acc9b78235bb4670 to your computer and use it in GitHub Desktop.
Recursively find and remove files by extension in Linux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment