Results 1 to 5 of 5
Hi all,
I would like to know how to introduce a progress bar with cp?
I am modifying one of the boot scripts where in i need to cp some ...
- 05-23-2008 #1Just Joined!
- Join Date
- May 2008
- Posts
- 20
cp progress bar needed....
Hi all,
I would like to know how to introduce a progress bar with cp?
I am modifying one of the boot scripts where in i need to cp some heavy files to another dest....Since these files come upto 500mb i needed a progress bar...
would like to know how to write one?
I googled up for this but were of no use in a boot script (binaries were not present for many cmds)
So i ported the required binaries and modified the scripts that i found on the net to my suiting but it works fine when run in the regular env but put it in a boot script of an OS ,it beings to crib....
So could you pls help me in getting a cp progress bar that can be included in a boot script(which is a part of the ramdisk!!)
Thanks
- 05-23-2008 #2Linux Guru
- Join Date
- Nov 2007
- Location
- Córdoba (Spain)
- Posts
- 1,513
There have been a lot of patches around in the past to add this functionality into cp, but none of them were sane implementations (horrid performance hit).
For example:
Gentoo Forums :: View topic - mv - sort of progress bar?
Now, for the solution: I'd just use scp locally or rsync which can copy files locally as well, and give some output while doing it.
- 05-23-2008 #3
Personally, the best way I've found to do this with a script alone is a bit limited.
You can basically use the 'du' or command to list the size of entire directories recursively, or if you just want to watch the progress of one file, you can use 'ls', which will be must less of a performance hit.
This will just watch the destination directory's file size, and you can pretty much just keep an eye on it all while it grows. However, it only really works for files, if you're putting something into subdirectories, it won't count that data, and that will lead to problems.Code:while ls -lh *destination directory or single file*; do sleep 5s && clear; done
What works equally well, but perhaps more slowly
Code:while du -ha --max-depth 1 /destination/ ; do sleep 5s && clear; done
- 05-24-2008 #4Linux Engineer
- Join Date
- Apr 2006
- Location
- Saint Paul, MN, USA / CentOS, Debian, Solaris, SuSE
- Posts
- 1,117
Hi.
One solution that was posted is http://www.linuxforums.org/forum/lin...tml#post537099
This is more general in that one can use it with any process that might take a long time. It is an indicator that something is still going on, but not a precise measure of how much work is done and how much work remains ... cheers, drlWelcome - get the most out of the forum by reading forum basics and guidelines: click here.
90% of questions can be answered by using man pages, Quick Search, Advanced Search, Google search, Wikipedia.
We look forward to helping you with the challenge of the other 10%.
( Mn, 2.6.n, AMD-64 3000+, ASUS A8V Deluxe, 1 GB, SATA + IDE, Matrox G400 AGP )
- 10-20-2010 #5Just Joined!
- Join Date
- Oct 2010
- Posts
- 2
just use
and you have a perfect progress informationCode:rsync -P sourcefile destfile


