|
Written by Roceller Alvarez
|
|
Tuesday, 16 May 2006 |
|
To delete old files in unix, you can execute the following command from the shell:
find <path> -mtime +30 -exec rm -f {} \;
For example, to delete all file more than 30 days older:
find /tmp -mtime +30 -exec rm -f {} \;
About FIND command:
NAME find - find files
SYNOPSIS /usr/bin/find path... expression
/usr/xpg4/bin/find path... expression
DESCRIPTION The find utility recursively descends the directory hierar- chy for each path seeking files that match a Boolean expres- sion written in the primaries given below.
find will be able to descend to arbitrary depths in a file hierarchy and will not fail due to path length limitations (unless a path operand specified by the application exceeds PATH_MAX requirements).
for more info, type "man find" from your shell.
Only registered users can write comments. Please login or register. Powered by AkoComment 2.0! |