I need â€¦ to back up all files in a specified directory that have been modified after some inputted date or time
Consider using find
find yourdirectory \( -type f -o -type d \) -mtime -4
will find in yourdirectory
all files or directories (-type f -o -type d
) last modified in less than 4*24 hours (-mtime -4
You can backup them with cpio
find yourdirectory \( -type f -o -type d \) -mtime -4 -print0 | cpio -0ov >yourbackup.last4days.cpio
When reading man find
pay attention to the following options: -mtime, -mmin (the same as -mtime but time range in minutes), -daystart.
Date arithmetic remains up to you.
UseFreeTools â€” my blog about GNU/Linux and Free Software