Say I have these files in dir1:
-rw-r--r-- 1 user user 10240 Jul 2 11:54 10_data.txt
-rw-r--r-- 1 user user 36048 Jul 4 11:56 95_data.txt
-rw-r--r-- 1 user user 35634 Jul 7 11:56 01_data.txt
-rw-r--r-- 1 user user 10630 Jul 9 11:56 19_data.txt
-rw-r--r-- 1 user user 35476 Jul 9 11:57 93_data.txt
I want to be able to copy these files based on their timestamps, specifically the day of the month (2, 4, 7 and 9).
Ex:
copy 10_data.txt into a directory called 02
copy 19_data.txt into a directory called 09
copy 93_data.txt into a directory called 09
Destination directories (01, 02, 03 , etc.) would already exist, so no need to create them or anything. I plan to run this as a cron job daily after midnight.
Can I use find
for this task along with (date +%d)
or something like that?
Thank you!