Can some one show me a shell script to remove files older than yesterday. I mean, today its 23rd June and i need to delete the files that are older than 21st June. How can i do that ? Please help me.
Can some one show me a shell script to remove files older than yesterday. I mean, today its 23rd June and i need to delete the files that are older than 21st June. How can i do that ? Please help me.
Its very simple. Here it is :-
find /path/to/dir -type f -mtime +3 -exec rm \{\} \
To find a file that, but less than 24 hours ago yesterday was amended, try this:
find . \! -cnewer date_marker
To find files created before that date, use the cnewer and negation conditions:
find . -newer date_marker
The day starts at the actual beginning of the day, not 24 hours ago.
find . -daystart -atime 1 -maxdepth
Its $ find /path/to/folder -mtime +3 -exec rm -f {} \;,Where the first argument the path to the files. This can be a way or a folder.The second argument, -mtime, is used to specify the number of days old that the file is. If you enter +5, it will find files older than 5 days.The third argument - exec, allows you to enter a command such as rm so. () \; At the end is required for command to terminate.
Thanks a lot guys,,, that is all what i needed .I appreciate your quick help.
Thank You!!
Bookmarks