In this example X is replaced with 7.
List all files older than X days:
find /path/to/files/ -type f -mtime -7 -exec ls -l {} \;
Delete all files older than X days:
find /path/to/files/ -type f -mtime -7 -exec rm -f {} \;
Move all files with extension '.arc' older than X days:
List all files older than X days:
find /path/to/files/ -type f -mtime -7 -exec ls -l {} \;
Delete all files older than X days:
find /path/to/files/ -type f -mtime -7 -exec rm -f {} \;
Move all files with extension '.arc' older than X days:
find /path/to/files/ -type f -name '*.arc' -mtime +7 -exec mv {} /path/to/archive/ \;
No comments:
Post a Comment