-
April 28th, 2006, 08:04 PM
#1
Banned
Help with diff command
Ok heres my situation
I have 2 operating systems on my box. Slackware 10 and Windows XP Pro.
Pro was installed first and I had just recently installed Slackware
When installing Slackware I have my windows partion mounted as /fat-c (although its nfts). And its read-only.
Problem: I have my up-to-date music folder on the /fat-c and my not so up date Music folder in my /home directory on Slackware. I want to be abe to run a command that compares the two folders, finds differences and copies the differences into the slackware folder.
I want to use diff and pipe it into cp or vise versa.
I tried
cp -r |diff Music1 Music2| cut -d: f1
But it didnt work. Any suggestions?
-
April 29th, 2006, 02:41 PM
#2
Hi
Interesting little project - file synchronisation tool with diff 
I like such things, so I did something...
Code:
diff -r first second |awk '{if ($1=="Only"){source=$3;sub(/:/,"",source);target=source;
if ($3~/^first/) {sub(/first/,"second",target);print "cp -r "source"/"$4" "target} else
if ($3 ~ /^second/) {sub(/second/,"first",target);print "cp -r "source"/"$4" "target}}}' |sh
(all on one line)
replace all occurances of "first" and "second" with you folder names.
If you want to see what it does without having it doing it,
remove the "|sh" at the end (recommended!). And of course,
it may not work correctly in some cases...
Maybe it is of advantage to use the standard tools, like rsync, unison...Have a look
at this list[1]. On windows, I like Foldermatch[2].
Cheers
[1] http://linas.org/linux/, Data Mirroring, Replication and File Synchronization
[2] http://www.foldermatch.com/
If the only tool you have is a hammer, you tend to see every problem as a nail.
(Abraham Maslow, Psychologist, 1908-70)
-
April 29th, 2006, 05:35 PM
#3
Banned
Thanks I'll try it out
-
April 29th, 2006, 11:47 PM
#4
Originally posted here by aura2
Thanks I'll try it out
Got your multiple accounts mixed up huh? Let me help you sort this out.
rm -rf you*
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|