LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 08-05-2007, 10:30 PM   #1
Four
Member
 
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, 10:50 PM   #2
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,898

Rep: Reputation: 353Reputation: 353Reputation: 353Reputation: 353
Try this:

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

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

Rep: Reputation: 220Reputation: 220Reputation: 220
Try using rsync:

$ rsync -av --delete a/ b/

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


Reply


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 01:51 AM
Active Directory User Cannot Write to Samba Home Directory jonwatson Linux - Networking 2 12-19-2006 01:40 PM
LXer: Directory services made easy with Fedora Directory Server LXer Syndicated Linux News 0 12-08-2006 04:54 AM
updating kernel, no '/usr/src/linux' directory? rubbercash SUSE / openSUSE 2 04-30-2005 02:00 PM
Nautilus - "automatic updating" of directory contents Locura Linux - Software 0 12-03-2003 05:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

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