Friday, September 14, 2012

How to tar the recently modified files linux?



To accomplish this we need two commands

- Find command - to find the files which are modified

find . -mtime -5 -type f -name "*.php" ( It gets all the php files which are modified 5 days ago)

- Tar command - to create an archive
tar cvf changed_201006014.tar - It creates the archive with the name "changed_20100614.tar"

combine above two commands

tar cvf changed_20100614.tar `find . -mtime -5 -type f -name "*.php"`

It creates archive with the files which are modified 5 days ago.

No comments:

Post a Comment