Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I tar files between certain dates?

Status
Not open for further replies.

jared71

MIS
Jul 2, 2001
58
US
Hello,

I need a hand here.

I have several gig's of production reports which I need to tar up and move to a different server. I've already moved files from the past two years up to May 30th. I need to move the remaining files and directories from May 30th to the present and dump them into the new directory structure which was coppied over 5/30.

Here's the dilema. All the files fall under a directory structure created around groups ranging betwwen 1000-9000, under those, each group has a user directory between 01-99, then in each of those here are several hunderd reports (files dating back a few years). Unfortunaetly, when I try to tar up the reports from the last month,

>find . -ctime -30 -exec tar -cf /dir/file.tar {} \;

I end up tarring up way more than I need. Can anyone suggest a way to make this work?

Thanks in advance.

Jared
 
ctime -30 looks like the way to go to me, what is it doing wrong? Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
It was tarring up way too much info. I was using a verbose mode, and all of the ctimes looked correct, but I know for a fact that our application wouldn't have generted a gig of reports in that time period. It almost looked as though it would read some of the directories, and tar the entire contents instead of just the newly created files.

jared
 
Have you looked at the -type parameter in the find command?

-type c True if the type of the file is c, where c is b, c, d, D, f, l, p, or s for block special file, character special file, directory, door, plain file, symbolic link, fifo (named pipe), or socket, respectively.
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top