Linux Forums - Linux Help,Advice & support community:LinuxSolved.com

Others => Miscellaneous => Topic started by: craig_linuxsolved on June 27, 2009, 03:17:02 PM

Title: cp command or mv or ?
Post by: craig_linuxsolved on June 27, 2009, 03:17:02 PM
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?
Title: Re: cp command or mv or ?
Post by: Yogesh on June 29, 2009, 07:17:25 AM
use mv -Rf olddirname newdirname.
Title: Re: cp command or mv or ?
Post by: eth1 on July 03, 2009, 06:21:59 PM
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: [Select]
[root@dev]# cp -pv --reply=yes new test/
`new' -> `test/new'

This will do the trick.
Title: Re: cp command or mv or ?
Post by: dragoncity99 on October 29, 2009, 03:13:19 PM
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)