[x] Welcome to LinuxSolved.com Linux help forums, here we are a community of Linux users helping each other. It is helpful to both ie. new linux users as well experienced one. We always have our experts to help you and ofcourse members help each other, so you can ask for help any time by Registering.: Click to Register

Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Linux Forums - Linux Help,Advice & support community:LinuxSolved.com  |  Forum  |  Others  |  Miscellaneous  |  Topic: cp command or mv or ?
Welcome to LinuxCommunity

You have just arrived to a friendly linux community which is helping Linux Users from Years.. You can be its part if you have not already joined it. Registration is FREE and is gateway to unlimited help and support to all your linux related needs. If you are an GNU/Linux supporter then you have come to the right place.
Pages: [1]
  Print  
Author Topic: cp command or mv or ?  (Read 566 times)
0 Members and 1 Guest are viewing this topic.
craig_linuxsolved
New Member

Offline Offline

Posts: 1


View Profile
« on: June 27, 2009, 11:17:02 AM »

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?
Logged
Yogesh
New Member

Offline Offline

Posts: 1


View Profile
« Reply #1 on: June 29, 2009, 03:17:25 AM »

use mv -Rf olddirname newdirname.
Logged
eth1
New Member

Offline Offline

Posts: 1


View Profile
« Reply #2 on: July 03, 2009, 02: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:
[root@dev]# cp -pv --reply=yes new test/
`new' -> `test/new'

This will do the trick.
Logged
dragoncity99
LST CareTaker
Experienced
*****
Offline Offline

Gender: Male
Posts: 524


View Profile
« Reply #3 on: October 29, 2009, 11:13:19 AM »

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)
Logged
Pages: [1]
  Print  
 
Jump to:  

Related Topics
Subject Started by Replies Views Last post
make command Linux Kernel « 1 2 3 » smb2004 34 8292 Last post May 11, 2005, 10:47:16 AM
by /root
awk command Linux Development & Programming mrsinghal 1 1297 Last post March 30, 2005, 04:03:45 AM
by neo
Find Command Os Talk gauravbajaj 12 2588 Last post December 26, 2007, 02:24:47 AM
by dragoncity99
Hi plz.. help me in finding the command Linux Development & Programming rammu_sivraj 1 929 Last post July 04, 2006, 02:14:54 AM
by dragoncity99
Difference In Command Miscellaneous rajesh.bahl 3 815 Last post December 18, 2007, 01:53:10 AM
by Ricky
Search LS
Welcome, Guest. Please login or register.
Did you miss your activation email?
February 09, 2010, 07:21:06 AM

Login with username, password and session length
Navigation
Recent Discussions
[Today at 05:44:11 AM]

[Today at 04:16:11 AM]

[February 08, 2010, 01:07:09 AM]

[February 06, 2010, 10:34:53 AM]

[February 06, 2010, 07:21:41 AM]

[February 05, 2010, 03:48:46 AM]

[February 05, 2010, 03:44:19 AM]

[February 04, 2010, 11:49:15 AM]

[January 27, 2010, 06:04:57 AM]

[January 27, 2010, 06:03:25 AM]
Members
Total Members: 7475
Latest: Rajeevrvis
Stats
Total Posts: 9376
Total Topics: 2672
Online Today: 10
Online Ever: 111
(June 28, 2007, 06:47:29 AM)
Users Online
Users: 0
Guests: 14
Total: 14
Privacy Policy| Powered by SMF 1.1.7 | SMF © 2006-2008, Simple Machines LLC Theme & TinyPortal v0.9.8 © Bloc