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

Copying file from one system to another using find cmd

Status
Not open for further replies.

funstur

Technical User
Feb 15, 2001
66
GB
As part of a backup plan I need to copy files that have been amended or created within the last 24hours. I need to run a script from crond that does this prior to a backup of this area.

I was going to used the find cmd pipe this to a text file the used the text file to copy files listed onto a separate mount, different file system, bothe systems are linux 7.2/8.0.

any help will be gratefully recieved

Funstur
 
Hi

If you want to find files(not dirs) that not have been used for the last 24 hours

This exampel will copy all files in /home/user/public_html/ that have been accessed within the last day and it will the copy alla files to /home/user/backup/

find /home/user/public_html/ -atime -1 -type f -exec cp {} /home/user/backup/ \;


 
and then you can replace the /home/user/backup/ with the path to your mounted disk or whatever...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top