Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 08-05-2007, 09:30 PM   #1
Registered: Aug 2005
Posts: 298

Rep: Reputation: 30
updating a directory

I have 2 directory's a/ and b/. I do

cp -u -R a/ b/ -v

to update b/ what happens is a/ gets copied into b/a/. I want b/ to be exactly like a/. I could remove b and copy a to b but thats to many files even if it copies each file disregarding if its unchanged is alot of files.

How may I update b/ to match a/?

Thank you
Old 08-05-2007, 09:50 PM   #2
LQ Addict
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,887

Rep: Reputation: 351Reputation: 351Reputation: 351Reputation: 351
Try this:

cp -u -R a/* b/ -v

Last edited by bigrigdriver; 08-05-2007 at 09:52 PM.
Old 08-05-2007, 09:53 PM   #3
Senior Member
Registered: Oct 2003
Posts: 2,533

Rep: Reputation: 211Reputation: 211Reputation: 211
Try using rsync:

$ rsync -av --delete a/ b/

rsync is a much better tool for keeping two directories in sync. See man rsync.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Username & Password Sync Fedora Directory and Microsoft Active Directory karnac01 Fedora 4 07-19-2010 12:51 AM
Active Directory User Cannot Write to Samba Home Directory jonwatson Linux - Networking 2 12-19-2006 12:40 PM
LXer: Directory services made easy with Fedora Directory Server LXer Syndicated Linux News 0 12-08-2006 03:54 AM
updating kernel, no '/usr/src/linux' directory? rubbercash SUSE / openSUSE 2 04-30-2005 01:00 PM
Nautilus - "automatic updating" of directory contents Locura Linux - Software 0 12-03-2003 04:29 AM

All times are GMT -5. The time now is 03:06 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration