💡 Daily Tips: Basic Linux commands used for File and Directory Management 🐧📂🐍 #Linux #FileManagement #LinuxCommands #Python
What will be the command to find all files in all sub directories to delete, where file name ends with .log ?
Looking to find all files with a .log extension in subdirectories? Use this command: find /your/directory/path -type f -name "*.log" If you want to delete them: find /your/directory/path -type f -name "*.log" -exec rm {} \; Remember, "exec rm {} \;" permanently deletes files
Great, can you please differentiate with Delete command. I am using this command to delete all the files older than 7 days. find /your/directory/path -type f -name "*.log" -mtime +7 delete;
Thanks for your answer. "-exec rm {} \;" This option performs the delete (rm) operation for each file found by the find command.
United States Trends
- 1. #UFC322 38.5K posts
- 2. Ewing 5,703 posts
- 3. Bama 19.2K posts
- 4. Wellmaker 4,031 posts
- 5. Oklahoma 29.3K posts
- 6. Noah Thomas N/A
- 7. #AEWCollision 4,789 posts
- 8. Wingo 1,324 posts
- 9. Arch 17.7K posts
- 10. Ty Simpson 3,850 posts
- 11. Jeremiah Smith 2,087 posts
- 12. Bronny 5,110 posts
- 13. Boomer Sooner 2,173 posts
- 14. #GoDawgs 5,166 posts
- 15. Georgia 79K posts
- 16. UConn 4,746 posts
- 17. Iowa 20.1K posts
- 18. Sabatini 1,386 posts
- 19. Shapen N/A
- 20. Lagway 1,274 posts
Something went wrong.
Something went wrong.