Unix/Linux Go Back    


Programming Post questions about C, C++, Java, SQL, and other programming languages here.

Program or bash script to see total progress of copy

Programming


Reply    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 1 Week Ago
robertkwild robertkwild is offline
Registered User
 
Join Date: Apr 2016
Last Activity: 22 September 2017, 7:35 AM EDT
Posts: 74
Thanks: 7
Thanked 5 Times in 4 Posts
Program or bash script to see total progress of copy

hi all,

i want a program or to make a bash script to find out the total ETA/percent (would be nice aswell a progress bar) of a copy recursive command

so lets say i do -


Code:
cp -r /source_folder/ /destinatation_folder/

and when i run it i get no information on the screen of how the copy is progressing

i have tried using "pv" and "progress" commands but to no avail, they just give me the ETA/progress of individual files copied in the directory but not the total ETA/progress of the whole directory

any help,

rob
Sponsored Links
    #2  
Old Unix and Linux 1 Week Ago
rbatte1 rbatte1 is offline Forum Staff  
Root armed
 
Join Date: Jun 2007
Last Activity: 25 September 2017, 8:55 AM EDT
Location: Lancashire, UK
Posts: 3,261
Thanks: 1,391
Thanked 630 Times in 569 Posts
You don't say what OS you have, but I would suggest pv is the tool for you.

Have a try and show us what's happening if it doesn't do what you need. It may be that you could use tar to bundle them into a single archive, pipe them through pv and extract at the other side.



Kind regards,
Robin

Last edited by rbatte1; 1 Week Ago at 12:23 PM.. Reason: Comment about using tar to have a single file passing through pv
Sponsored Links
    #3  
Old Unix and Linux 1 Week Ago
drl's Unix or Linux Image
drl drl is online now Forum Advisor  
Registered Voter
 
Join Date: Apr 2007
Last Activity: 25 September 2017, 9:30 AM EDT
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 2,169
Thanks: 221
Thanked 401 Times in 346 Posts
Hi.

1) None of the solutions from Linux Forums or command line - How can I move files and view the progress (e.g. with a progress bar)? - Unix & Linux Stack Exchange were of any help?

2) On what characteristic do you want to see progress: bytes, blocks, files, or something else?

Best wishes ... cheers, drl
    #4  
Old Unix and Linux 1 Week Ago
robertkwild robertkwild is offline
Registered User
 
Join Date: Apr 2016
Last Activity: 22 September 2017, 7:35 AM EDT
Posts: 74
Thanks: 7
Thanked 5 Times in 4 Posts
smashed it -


Code:
[root@robw-linux data]# tar -c call_the_midwife_7_1708/ | pv -lep -s 32455212 | tar -x -C /mnt/local/data/new/
[=> ] 2% ETA 2:34:31

and to find the dir size i did -


Code:
du -s call_the_midwife_7_1708/

but doing it via this method takes ages as its creating the tar and extracting the tar, normally doing a normal copy only takes roughly 18 minutes

Moderator's Comments:
Program or bash script to see total progress of copy Please use CODE tags as required by forum rules!

Last edited by RudiC; 1 Week Ago at 02:57 AM.. Reason: Added CODE tags.
Sponsored Links
    #5  
Old Unix and Linux 1 Week Ago
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 22 September 2017, 5:42 PM EDT
Location: Saskatchewan
Posts: 22,417
Thanks: 1,126
Thanked 4,239 Times in 3,919 Posts
How much data is it, and how fast are your disks?
Sponsored Links
    #6  
Old Unix and Linux 1 Week Ago
robertkwild robertkwild is offline
Registered User
 
Join Date: Apr 2016
Last Activity: 22 September 2017, 7:35 AM EDT
Posts: 74
Thanks: 7
Thanked 5 Times in 4 Posts
32gigs

Its my data drive not o/s drive so its Sdb single spindle at 72rpm
Sponsored Links
    #7  
Old Unix and Linux 1 Week Ago
Corona688 Corona688 is offline Forum Staff  
Mead Rotor
 
Join Date: Aug 2005
Last Activity: 22 September 2017, 5:42 PM EDT
Location: Saskatchewan
Posts: 22,417
Thanks: 1,126
Thanked 4,239 Times in 3,919 Posts
How about rsync? It supports progress and same-system copy:


Code:
rsync -aI --progress source/ destination

-a for recursive, and -I to ignore timestamps and copy everything it finds.

Note the trailing / on the source is important! Otherwise you'll end up with destination/source/filename instead of destination/filename
The Following User Says Thank You to Corona688 For This Useful Post:
rbatte1 (1 Hour Ago)
Sponsored Links
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Linux More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Running a C/C++ program and/or bash script from a server frad UNIX for Dummies Questions & Answers 1 12-13-2013 11:50 AM
Putting bash script in C program SkySmart Programming 15 03-06-2013 05:23 PM
bash script to copy files dodgefan67 Shell Programming and Scripting 8 04-06-2011 11:40 PM
Run Program from Bash CGI-Script JMooney5115 Homework & Coursework Questions 8 01-27-2011 06:51 PM
Making a progress gauge in a bash script ccox85 Shell Programming and Scripting 1 01-31-2008 01:16 PM



All times are GMT -4. The time now is 09:32 AM.