LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-08-2009, 08:21 AM   #1
bzenowich
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Rep: Reputation: 0
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:
----
#!/bin/sh
files="`echo $NAUTILUS_SCRIPT_SELECTED_URIS`"

# 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?

Thanks,

-Brian Z.
 
Old 10-08-2009, 10:50 AM   #2
pg99
Member
 
Registered: May 2008
Location: UK
Distribution: Slackware
Posts: 73

Rep: Reputation: 18
or you could use KDiff
 
Old 10-08-2009, 11:34 AM   #3
bzenowich
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by pg99 View Post
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"

...in 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!

Thanks,

-Brian Z.
 
Old 10-08-2009, 01:47 PM   #4
bzenowich
LQ Newbie
 
Registered: Oct 2009
Posts: 3

Original Poster
Rep: Reputation: 0
My co-worker drafted this python script to compare either local or remotely mounted files using meld from Nautilus...
Attached Files
File Type: txt MeldCompare.py.txt (587 Bytes, 77 views)
 
  


Reply

Tags
bash, compare, gvfs, nautilus, script


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
comparing directories and files crazy8 Linux - Newbie 4 01-16-2008 10:33 AM
Comparing directories ursusman Linux - Newbie 5 07-04-2006 06:56 AM
CHMOD directories.sub-directories.files zerojosh Linux - Software 2 11-19-2005 03:22 PM
Searching multiple directories and sub directories for a file jeep99899 Linux - Newbie 2 10-13-2005 12:23 PM
check for matching files when comparing directories WarriorWarren Linux - General 3 05-07-2003 01:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:48 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
Open Source Consulting | Domain Registration