programming faqs interview questions tech technical educational freshers guide preparation interviews hr telephonic
try another color:
try another fontsize: 60% 70% 80% 90%
ProgrammingFAQs

How to tar the recently modified files linux

To accomplish this we need

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.