💡 Daily Tips: Basic Linux commands used for File and Directory Management 🐧📂🐍 #Linux #FileManagement #LinuxCommands #Python

PythonTurkCom's tweet image. 💡 Daily Tips:

Basic Linux commands used for File and Directory Management

🐧📂🐍 #Linux #FileManagement #LinuxCommands #Python
PythonTurkCom's tweet image. 💡 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

PythonTurkCom's tweet image. 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.

PythonTurkCom's tweet image. Thanks for your answer. 

"-exec rm {} \;"  This option performs the delete (rm) operation for each file found by the find command.

United States Trends
Loading...

Something went wrong.


Something went wrong.