Linux Format forums Forum Index Linux Format forums
Help, discussion, magazine feedback and more
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Compare Folders

 
Post new topic   Reply to topic    Linux Format forums Forum Index -> Discussion
View previous topic :: View next topic  
Author Message
nigel.taylor



Joined: Tue Mar 13, 2012 10:33 am
Posts: 6

PostPosted: Tue Mar 13, 2012 10:38 am    Post subject: Compare Folders Reply with quote

HI Guys,

I am a complete newbie to Linux and have been chucked in the deepend.

I have a network share with approx 10,000 images hosted on a Windows 2003 server that I need to compare with a folder full of images held on a Ubuntu Server 10.4 LTS.

Does anyone know of any tools that compares folders between the two platforms? or any other approch that I can take to this?

Thanks in advance.

Regards,

Nigel
Back to top
View user's profile Send private message
Dutch_Master
LXF regular


Joined: Tue Mar 27, 2007 2:49 am
Posts: 2439

PostPosted: Tue Mar 13, 2012 10:56 am    Post subject: Reply with quote

Welcome. It depends on what you want to do with the results. If you want to update one folder from the other (that is: see if files on one are present on the other and if not copy them over) then rsync does the job perfectly. But if all you want to do is seeing if there's a difference between the folders, the diff tool has to be your choice. It compares 2 text files, and those text files can be generated by having the output of the ls command piped to a text file. Mind, it's commandline stuff, so get your DOS hat on and be prepared for a shock: bash (the standard Linux shell) is much more powerful then you'd ever imagined Wink

On the Ubuntu machine, enter this in a terminal:
Code:
ls /path/to/image/folder > lsimage.txt
ls /path/to/win-server/folder > win-image.txt
diff [options] lsimage.txt win-image.txt > diff.txt
See the man page for diff to get a sense of what options you need (on the Ubuntu machine)...

Useful link: http://ss64.com/bash/
Back to top
View user's profile Send private message
nigel.taylor



Joined: Tue Mar 13, 2012 10:33 am
Posts: 6

PostPosted: Tue Mar 13, 2012 11:44 am    Post subject: Reply with quote

Thanks for the quick response Dutch_Master.

Yes I have a mountain of stuff to learn regarding the Linux OS let alone the web application that we are going to be running our website on.

That is a great idea doing a dump of the outputs to a text file and then comparing them. I know there is then going to be files that I will need to get over to the Ubuntu server. Is there any tools that you would then recommend for then connecting to the machine to be able to copy the files over?

Regards,

Nigel
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8467
Location: Warrington, UK

PostPosted: Tue Mar 13, 2012 12:07 pm    Post subject: Reply with quote

[url="http://www.cis.upenn.edu/~bcpierce/unison/"]Unison[/url] sounds like a perfect fit for this job.

Quote:
Unison is a file-synchronization tool for Unix and Windows. It allows two replicas of a collection of files and directories to be stored on different hosts (or different disks on the same host), modified separately, and then brought up to date by propagating the changes in each replica to the other.


I haven't tried the Windows version but use it many times each day for synchronising Linux boxes.
_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
nigel.taylor



Joined: Tue Mar 13, 2012 10:33 am
Posts: 6

PostPosted: Tue Mar 13, 2012 12:24 pm    Post subject: Reply with quote

Thanks for that Nelz. I will give it a try and let you know how I get on.

Regards,

Nigel
Back to top
View user's profile Send private message
Bruno
LXF regular


Joined: Tue Sep 18, 2007 7:07 pm
Posts: 139
Location: Cambridgeshire, UK

PostPosted: Tue Mar 13, 2012 1:18 pm    Post subject: Reply with quote

I recommend Unison, too, I use it on both Linux and Windows. When installing on Windows, you will also need to install something called GTK+ for Windows Runtime Environment, it's a tool-kit for drawing Unison's GUI. After installing it, you may then need to add its location to your "Path" environment variable (if the installer didn't already do so) which should be here:

Code:
C:\Program Files\GTK2-Runtime\bin


With two collections stored on media that use different file systems (as is the case with Linux and Windows), Unison may throw up an error when it tries to synchronise the permissions of the files. If this happens, add the following lines to Unison's profile files (located at ~/.unison/*.prf on Linux and C:\Documents and Settings\<user>\.unison\*.prf on Windows):

Code:
perms = 0
dontchmod = true


Also watch out for failures to synchronise files whose names contain characters that are illegal in the other file system.
Back to top
View user's profile Send private message
guy
LXF regular


Joined: Thu Apr 07, 2005 1:07 pm
Posts: 1071
Location: Worcestershire

PostPosted: Tue Mar 13, 2012 9:56 pm    Post subject: Reply with quote

Unison sounds great for what I want too, to sync my files between two boxes with different versions of debian.

But the eternal noob is cautious enough to ask some questions first:

Do I need to install it on one host or both?
If both, does it matter if I install different versions on each box?

And do I need to do anything to make the boxes accessible to each other? This needs a level of security, so that other boxes on my network (e.g. visiting kids' laptops) cannot access them.
_________________
Cheers,
Guy
The eternal help vampire
Back to top
View user's profile Send private message
nelz
Site admin


Joined: Mon Apr 04, 2005 12:52 pm
Posts: 8467
Location: Warrington, UK

PostPosted: Tue Mar 13, 2012 10:07 pm    Post subject: Reply with quote

Install on both. It has to be the same version, but that's unlikely to be a problem. It uses SSH to communicate, so you just need to set up key authentication for the user(s) - but you should have that anyway.
_________________
"Insanity: doing the same thing over and over again and expecting different results." (Albert Einstein)
Back to top
View user's profile Send private message
View previous topic :: View next topic  
Display posts from previous:   
Post new topic   Reply to topic    Linux Format forums Forum Index -> Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Linux Format forums topic RSS feed 


Powered by phpBB © 2001, 2005 phpBB Group


Copyright 2011 Future Publishing, all rights reserved.


Web hosting by UKFast