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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

copy files from different directories for certian dates 1

Status
Not open for further replies.

adamsd

Technical User
Jul 28, 2002
37
AU
Hello,

Is a faster way to copy a number of files including sub directories for a certian period eg : files from 15/12/02 to 12/03/03 to another location and maintaining the same directory structure.

Any help will be much appreciated.

Cheers
Dexter
 
There are some ideas in this thread we could make use of: thread60-511142 this:

[tt]touch -t 200212150000 /tmp/startdate
touch -t 200303120000 /tmp/enddate
find src -type f -newer /tmp/startdate ! -newer /tmp/enddate | cpio -vdump dest/
rm /tmp/startdate /tmp/enddate[/tt]

Obviously replace src and dest with your source and destination directories. find lists all files in src that are newer than /tmp/startdate and older than /tmp/enddate and prints them to stdout. cpio -p reads these filenames from stdin and copies them to the destination directory maintaining the diretory structure, ownership of files, etc.

Annihilannic.
 
Thanks for that...much appreciated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top