LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-14-2009, 11:48 AM   #1
Drigo
Member
 
Registered: May 2009
Posts: 103

Rep: Reputation: 15
How to compare two folders and synconzie them by copying it


Hello,
I want to check to folder and copy the subfolders and/or files from the first folder to the second. Is this possible with a shell and the arguments? Also, if I can verify which folders are being copied it will be great.

Thank you very much.
 
Old 11-14-2009, 12:37 PM   #2
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,238

Rep: Reputation: 121Reputation: 121
man rsync
 
Old 11-14-2009, 03:52 PM   #3
jamwaffles
Member
 
Registered: Mar 2008
Distribution: Ubuntu Lucid
Posts: 131

Rep: Reputation: 19
A simpler option would be to use the cp command, with the -u switch. This sees if the files to be copied are newer than the source, for each file

for example,

cp -u -v -r /path/to/source/files/ /path/to/destination

cp - copy command
-u - update (check if file is newer...)
-v - say what cp is doing
-r - recursive - dont just copy the folder, copy its contents and everything in those folders

I hope this helps

Regards

James

Ps. This only really works for local stuff. For remote stuff, check rsync out
 
Old 11-14-2009, 08:15 PM   #4
Davno
Member
 
Registered: Mar 2004
Location: Montreal, Canada
Distribution: Mandriva 2010.2
Posts: 148

Rep: Reputation: 23
Quote:
Originally Posted by Drigo View Post
Hello,
I want to check to folder and copy the subfolders and/or files from the first folder to the second. Is this possible with a shell and the arguments? Also, if I can verify which folders are being copied it will be great.

Thank you very much.
If you know how to run bash script, this little script will work nicely.
Code:
#!/bin/bash
rsync -t -r -h --delete --progress --partial-dir=DIR --stats /mnt/sda1_data2/Flac_Ape/ /media/disk/Flac_Ape
Just change the /source /destination.
 
  


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
compare folders GUI linmix Linux - Newbie 4 09-12-2011 05:21 PM
can someone compare this 2 folders ..HELP bladez99 Linux - Newbie 4 08-10-2009 12:18 PM
How can I compare two folders to see if the directories are identical HGeneAnthony Linux - General 2 08-14-2008 05:55 AM
compare two folders bluenectar Linux - Newbie 10 08-04-2005 11:23 PM
How to compare two folders contents? rvoigt Linux - Newbie 6 01-07-2005 12:35 AM


All times are GMT -5. The time now is 02:49 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration