[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Find and copy script/piped command



A. John Peters writes....
> 
> I am trying to copy all files changed in the last 24 hours to a new
> directory.
> 
> find /home/Nursery -mtime -1
> I want all the results copied to todays directroy
> cp {results} /home/Thursday/

You're almost there.

find /home/Nursery -mtime -1 -exec cp {} /home/Thursday/ \;

NOTE:	This will overwrite files with the same name.  ie
	files /home/Nursery/Mail/foo and /home/Nursery/foo
	are going to have a conflict if they meet the -mtime rule

If you want to go the tar route, you can

tar -cvf Thursday.tar `find /home/Nursery -mtime -1`

but tar will choke if that list gets too long.

Another tar option is sending the list to a file.
I think tar has a -f or -F switch that gets its archive
list from a list of files.

> 
> If I have to I can tar with a z option.
> 
> Any hints?
> 
> 
> _______________________________________________
> Redhat-install-list mailing list
> Redhat-install-list redhat com
> https://www.redhat.com/mailman/listinfo/redhat-install-list
> To Unsubscribe Go To ABOVE URL or send a message to:
> redhat-install-list-request redhat com
> Subject: unsubscribe
> 


-- Jay Crews
jpc jaycrews com




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]