| View previous topic :: View next topic |
| Author |
Message |
nigel.taylor
Joined: Tue Mar 13, 2012 10:33 am Posts: 6
|
Posted: Tue Mar 13, 2012 10:38 am Post subject: Compare Folders |
|
|
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 |
|
 |
Dutch_Master LXF regular
Joined: Tue Mar 27, 2007 2:49 am Posts: 2353
|
Posted: Tue Mar 13, 2012 10:56 am Post subject: |
|
|
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
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 |
|
 |
nigel.taylor
Joined: Tue Mar 13, 2012 10:33 am Posts: 6
|
Posted: Tue Mar 13, 2012 11:44 am Post subject: |
|
|
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 |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8001 Location: Warrington, UK
|
Posted: Tue Mar 13, 2012 12:07 pm Post subject: |
|
|
[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. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
nigel.taylor
Joined: Tue Mar 13, 2012 10:33 am Posts: 6
|
Posted: Tue Mar 13, 2012 12:24 pm Post subject: |
|
|
Thanks for that Nelz. I will give it a try and let you know how I get on.
Regards,
Nigel |
|
| Back to top |
|
 |
Bruno LXF regular

Joined: Tue Sep 18, 2007 7:07 pm Posts: 139 Location: Cambridgeshire, UK
|
Posted: Tue Mar 13, 2012 1:18 pm Post subject: |
|
|
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 |
|
 |
guy LXF regular

Joined: Thu Apr 07, 2005 1:07 pm Posts: 830 Location: Worcestershire
|
Posted: Tue Mar 13, 2012 9:56 pm Post subject: |
|
|
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 noob |
|
| Back to top |
|
 |
nelz Moderator

Joined: Mon Apr 04, 2005 12:52 pm Posts: 8001 Location: Warrington, UK
|
Posted: Tue Mar 13, 2012 10:07 pm Post subject: |
|
|
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. _________________ Unix is user-friendly. It's just very selective about who it's friends are. |
|
| Back to top |
|
 |
| View previous topic :: View next topic |
|