Hello,
How can I move files based on age in the following scenario:
$SOURCE contains some subfolders with some files inside them.
Each subfolder contain files of the same date, but the last modofication date of the subfolder can be more recent than the date of the files inside it, e.g.:
$tree . -D
.
|-- [Feb 18 16:44] Folder1
| |-- [Feb 3 3:58] 1.jpg
| |-- [Feb 3 3:58] 2.avi
| `-- [Feb 3 3:58] 3.jpg
`-- [Feb 18 16:44] Folder2
|-- [Jan 29 3:33] a.jpg
|-- [Jan 29 3:33] b.jpg
|-- [Jan 29 3:33] c.avi
`-- [Jan 29 3:34] d.avi
If I try to move only the files newer than 15 days (today is Feb 18) with the following command, I get all the entire tree because it seems is just reading the date on the folders not on the files.
find $SOURCE -mtime -15 -exec mv {} $DEST \;
So, I want to move the files and the folders that contains the files to $DEST.