Others > Miscellaneous

cp command or mv or ?

(1/1)

craig_linuxsolved:
I've tried using cp to copy the contents of one directory to another and it won't drop/stop executing in interactive mode

I use the -Rfu

I want it to copy all the contents from folder X to folder Y replacing any file that is older with the newer file and to do this to all files at all levels under Y

Or can I or should I use a different linux command like "mv" and if so how.

I'm trying to update a blog engine.

Ok I've waiting all day for a response of some kind

There's got to be a command that will rewrite the contents of one folder and all it's sub folders to a an existing folder, updating files with newer dated files of the same name and adding and files not found in the destination folder. 

Is that clearer to anyone?

I don't see a recursive option in the "mv" command or is that automatic

anyone?

Yogesh:
use mv -Rf olddirname newdirname.

eth1:
I was checking the man page and cp does have an argument to provide an answer for the overwrite question.

cp -pv --reply=yes file folder/


--- Code: ---[root@dev]# cp -pv --reply=yes new test/
`new' -> `test/new'
--- End code ---

This will do the trick.

dragoncity99:
The reason why this happens most of the time is because of your shell has an alias  for ls.

Do this command:
# alias
(There's an -i switch there)

So if you want to keep your alias, specify fullpath to cp command and supply switches yourself
# /bin/cp -av /source/directory /destination/directory (EXample only)

Navigation

[0] Message Index

Go to full version