Click to See Complete Forum and Search --> : file copy question
miriamr
08-27-2001, 07:37 PM
Hi,
Is there a way to copy a set of files based on the date it was created or modified using cp command? Im going to use it to copy all my updated files to a backup folder but i dont know how to? the man pages of cp doesnt show much.
I appreciate any help coming. thanks.
:)
bdg1983
08-27-2001, 08:12 PM
Yes there would be using a combination of grep, piping, ls and cp.
I would really have to think about it and perhaps read some of the other man pages, but it can be done.
Hopefully someone here may have a script they have written to do this, otherwise just be patient and you may get the actual answer.
I do know it is possible. What in Linux is not?
Malakin
08-27-2001, 08:14 PM
I use "cp -Rudfp"
R means copy recursively and works with weird things like fifo's.
u means copy only if the source is newer.
d means preserve links instead of following them.
f means force all action and don't prompt.
p means to preserve file attributes if possible. (Not possible if you're copying to a file system that can't support them)
Edit: if you're trying to specify a certain date say with the last 24 hours or something like that let me know, a short script using find and cp will probably do the job fine.
[ 27 August 2001: Message edited by: idealego ]
Strike
08-27-2001, 08:39 PM
Please don't cross-post, I saw this in the programming/script depot forum as well. Pick one forum and post in that forum only.
miriamr
08-27-2001, 11:13 PM
hi,
cp -rupd works but only if the destination folder already contains copies of the files and your right i am looking for a way to copy only files with specific dates on a new folder. If you have a script to do that can you please it with this helpless soul :( . thanks in advance...
sorry for cross posting wont happen again