How to delete two days older files through script
Hi,
want to delete files older than 2 days through script can i have a snippet of code.. |
Hi!
A good place to start would be to do some reading to be able to write your first script. After you compose your script you could post it and other can give you insight/advice- http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO.html http://linuxconfig.org/Bash_scripting_Tutorial http://www.tldp.org/ This is a very good Bash Guide and was recommended by a Moderator; think you will find it helpful. http://tldp.org/LDP/Bash-Beginners-G...tml/index.html http://tldp.org/LDP/abs/html/ You mentioned that you want to delete files that are more than 2 days old- What type of files do you mean? Some files are configured to run your OS and should not under any circumstances be deleted or removed. |
Code:
find /path/for/your/files -mtime +2 -exec rm {} \; |
you forgot to quote the {} which happens to be a shell special character... (you did remember the ; though)
|
Quote:
find /path/ -mtime +num_days -exec rm {} \; |
All times are GMT -5. The time now is 11:02 PM. |