You are not logged in.
Is there a way i can copy with cp that if a file exists, it won't even copy that file.
Last edited by haxit (2009-01-08 23:30:48)
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
here:
yes n | cp -i src dest
edit: loool too late
Last edited by daf666 (2009-01-08 22:27:52)
Offline
Bash script was my last option I guess that is what I might have to do.
Last edited by haxit (2009-01-08 22:24:57)
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
-- Edit --
Solution already mentioned .
'cp -i' or 'cp --interactive' should warn you before any overwrite .
For details :
man cp
Last edited by Nezmer (2009-01-08 22:26:42)
English is not my native language .
Offline
I assume you've already done man cp -- if the answer's not there, it may end up being a little more complex, like writing a little shell script or something.
You might try cp -i, which runs it interactively. So you get "cp: overwrite `<file>'?" for every file that's already in the target directory, but depending on how many files you have, that could get cumbersome.
EDIT: Wow, there were a ton of responses while I was typing this.
Last edited by weasel8 (2009-01-08 23:04:13)
Offline
yes n | cp -i
Offline
I will write up a bash script comparing files in current directory and directory i want to copy to. No biggie
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline
Not sure, but check the "u" option.
Have you Syued today?
Free music for free people! | Earthlings
"Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away." -- A. de Saint-Exupery
Offline
Not sure, but check the "u" option.
Here is an example: So it depends on the situation if it's usable.
$ echo AA > a
$ echo BB > b
$ cp -u a b
$ cat a b
: AA
: BB
$ echo BB > b
$ echo AA > a
$ cp -u a b
$ cat a b
: AA
: AA
Offline
Not sure, but check the "u" option.
I think that is exactly what I am looking for! Thanks a lot. I didn't go THAT far down the man page
Archi686 User | Old Screenshots | Old .Configs
Vi veri universum vivus vici.
Offline