Странице

Ознаке

четвртак, 16. јануар 2014.

Find and delete files in linux

Remove files and directories
find . -name "FILE-TO-FIND" -exec rm -rf {} \;
Remove only files
find . -type f -name "FILE-TO-FIND" -exec rm -f {} \;
Find files older then 10 days
find /var/log -mtime +10
Find files older then 30 min
find /tmp -mmin +30
Remove files older then X days
find /path/* -mtime +5 -exec rm {} \;
Find and move files
find ~/projects/* -mtime +14 -exec mv {} ~/old_projects/ \;

Recursively Search All Files For A String:
cd /path/to/dir
find . -type f -exec grep -l "word" {} +
find . -type f -exec grep -l "seting" {} +
find . -type f -exec grep -l "foo" {} +

Нема коментара:

Постави коментар

Напомена: Само члан овог блога може да постави коментар.