Delete files older than X days in Linux
Its very simple and easy in Linux,
Just type this command
[root@akwal ~]# find /to/your/directory -mtime +20 -print
Or to delete files in current directory older then 20 days
[root@akwal ~]# find . -mtime +20 -exec rm -f {} \;
" . " (dot) is use for the current directory
" -mtime " parameter is used to find files older than X days.
" -delete " parameter to immediately let find delete the files.
" -exec " Parameter
Its very simple and easy in Linux,
Just type this command
[root@akwal ~]# find /to/your/directory -mtime +20 -print
Or to delete files in current directory older then 20 days
[root@akwal ~]# find . -mtime +20 -exec rm -f {} \;
" . " (dot) is use for the current directory
" -mtime " parameter is used to find files older than X days.
" -delete " parameter to immediately let find delete the files.
" -exec " Parameter
0 comments:
Post a Comment