Go Back   The UNIX and Linux Forums > Operating Systems > Linux
Search Forums:



Linux RedHat, Ubuntu, SUSE, Fedora, Debian, Mandriva, Slackware, Gentoo linux, PCLinuxOS. All Linux questions here!

Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 02-04-2012
absorber's Avatar
Registered User
 

Join Date: Jan 2012
Posts: 7
Thanks: 7
Thanked 0 Times in 0 Posts
Viewing the progress of diff?

I recently made an rsync backup of a relatively large directory with a lot of subdirectories (around 30GB size in total).
Now I'm trying to see if everything went well and every file is where it should be, so I'm using the diff command (to be more specific, diff -rq /dir_source /dir_dest), but I have no idea when it will finish.

So does anyone know of any way to view the progress of this process, or otherwise any other utility which has this progress function?
I'm using GNU diffutils 3.0

Thanks in advance.
Sponsored Links
    #2  
Old 02-05-2012
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 8,493
Thanks: 66
Thanked 399 Times in 388 Posts
You have to instrument your code as there is no progress bar or something that gives a running count of lines processed. And for what you are doing I would just use a checksum. All you want to know is: did it work okay? Not where some things differ in files, because you will just recopy to fix it.

And. Unless you got errors during copy, the probability of failure is really very low, except if you were ftp-ing from windows to Unix. You were not doing that.


Code:
#!/bin/bash
cd /path/to/oldfiles
export DEST=/path/to/newfiles
cnt=0
for fname in *
do
    old=$(cksum $fname )
    old=${old%% *}
    new=$(cksum $DEST/${fname})
    new=${new%% *}
    cnt=$(( $cnt +  1 ))
    [ $(( $cnt % 5 )) -eq 0 ] && echo "$cnt files processed"
    [ "$old" = "$new" ] && continue  
    echo "failure on file $fname"
done

Sponsored Links
    #3  
Old 02-05-2012
mark54g mark54g is offline Forum Advisor  
Registered User
 

Join Date: May 2008
Location: Northeastern United States
Posts: 871
Thanks: 1
Thanked 52 Times in 50 Posts
not sure if pv would work, but it might be worth a shot.
Sponsored Links
Reply

Tags
comparing directories, diff, progress

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
serach diff filename in diff location using shell scripting Lucky123 Shell Programming and Scripting 1 11-25-2011 02:44 AM
.procmailrc and uudeview (put attachments from diff senders to diff folders) optik77 Shell Programming and Scripting 1 03-27-2011 06:57 AM
Simulate SVN diff using plain diff ackbarr Shell Programming and Scripting 3 02-07-2009 12:01 PM
how to have a cp progress bar? wrapster UNIX for Advanced & Expert Users 1 05-21-2008 02:56 AM
diff 2 files; output diff's to 3rd file blt123 Shell Programming and Scripting 2 05-28-2002 11:29 AM



All times are GMT -4. The time now is 11:44 PM.