Archieve one weeks old txt files

Hi All,

Am trying to write a script which does the archiving of *.txt files if it's one week old from the current date.

/TK/Project_ATT/Results/
File format :

-rw-r-----   1 root     root       20562 Sep 11 10:24 UQ-CI01_FF_20130905_10H24M.txt
-rw-r-----   1 root     root       20562 Sep 11 10:29 UQ-CI01_FF_20130906_10H29M.txt
-rw-r-----   1 root     root       20562 Sep 11 10:26 UQ-CI01_FF_20130907_10H26M.txt
-rw-r-----   1 root     root       20562 Sep 11 10:29 UQ-CI01_FF_20130908_10H29M.txt
-rw-r-----   1 root     root       20562 Sep 11 10:29 UQ-CI01_FF_20130909_10H29M.txt
-rw-r-----   1 root     root       20562 Sep 11 10:30 UQ-CI01_FF_20130910_10H30M.txt
-rw-r-----   1 root     root       20596 Sep 11 10:34 UQ-CI01_FF_20130911_10H34M.txt

from the above *.txt, script should archive UQ-CI01_FF_20130905_10H24M.txt file (by taring the file) only since it's week old file from current date and putting into Archive directory.

/TK/Project_ATT/Archive/

-rw-r-----   1 root     root       20562 Sep 11 10:24 UQ-CI01_FF_20130905_10H24M.tar.gz

Any help will be much apprecitated.

Many Thanks,
Optimus81

Check this : mtime, ctime, and atime

find /TK/Project_ATT/Archive/*.txt -type -mtime +7 | xargs tar zcvf /somelocation/backup.tgz

First command find get you list of files
2nd command creates a tar and gzips them.

you can use something like below

 
find . -type f -name "*.txt" -mtime +7 -exec tar -zcvf UQ-CI01_FF_20130905_10H24M.tar {} \;