This is a directory structure:
I want to tar Directory1 with the conditions -
- It should include only those files that are modified in the last three days.
- Keep the directory structure intact.
The final tared output should be -
This is a directory structure:
I want to tar Directory1 with the conditions -
The final tared output should be -
find directory1 -type f -mtime -4d | xargs tar -cf your_archive_name
-mtime -4d
: find all files which were modified in less than 4 days
(-mtime 3d
will find all files which were modified exactly 72 hours 00 minutes 00 seconds ago – this is probably not what you are asking for)
Please stay out of directory1 and directory2 while running this command.
Add -z
option – tar -czf
– if in addition to archiving the files, you also want to compress them.