-   Linux - Software (
-   -   Comparing directories (

bzenowich 10-08-2009 08:21 AM

Comparing directories
I'd like to be able to select 2 samba-mounted directories in nautilus and compare their contents in meld.

The nautilus-scripts directory seems like a good way to add this feature to nautilus. Unfortunately, meld does not like to operate on network shares like "smb://server/path/to/directory". But it can operate on "~/.gvfs/path\ on\ server/to/directory" just fine, which gives me hope.

So far, I've got this:

# Yeah, alternative sed delimiters : or | really don't make this easier
gfiles=`echo $files | sed -e 's/smb\:\/\/\([^\/]*\)\/\([^\/]*\)\//\~\/\.gvfs\/\2\\ on\\ \1\//gi'`

#xterm -e "echo $gfiles;sleep 10"

meld $gfiles

But I am running into the dreaded "double-parsing" problem and I can't get the meld arguments to include the required backslashes in the "\ on\ " section. Without those backslashes, meld sees 6 arguments instead of 2.

I know about the whole single-quote vs. double-quote rule, but I suspect that even though I am single-quoting the sed arguments, the whole `echo` is being re-parsed by bash, killing my backslashes.

Can anyone find an alternative way of writing a nautilus-script that turns $NAUTILUS_SCRIPT_SELECTED_URIS into a valid, fully-escaped string to pass to meld? Maybe perl or awk or some other way of calling sed would work?


-Brian Z.

pg99 10-08-2009 10:50 AM

or you could use KDiff

bzenowich 10-08-2009 11:34 AM


Originally Posted by pg99 (Post 3712381)
or you could use KDiff

28 KDE-related dependencies later, I verified that KDiff3 does actually support the smb:// syntax, but I was really looking for a Gnome (Nautilus) solution, if possible.

The problem really boils down to this:
Writing a script in bash/perl/python/whatever that takes a bash variable in the form:

files = "smb://server/share/path1 smb://server/share/path2"

...and performs a simple find & replace to make it into:

files = "~/.gvfs/share\ on\ server/path1 ~/.gvfs/share\ on\ server/path2" order for it to be passed to meld correctly.

This seems like it should be easy, but the solution escapes me (pun intended).

I am sure someone could come up with an awesome one-liner to solve this!


-Brian Z.

bzenowich 10-08-2009 01:47 PM

1 Attachment(s)
My co-worker drafted this python script to compare either local or remotely mounted files using meld from Nautilus...

All times are GMT -5. The time now is 08:42 AM.