You are not logged in.

#1 2011-05-21 15:32:48

kdar
Member
From: Sweet home Alabama!
Registered: 2009-06-27
Posts: 356

Progress bar for terminal? (for mv, cp, rm)

Is there way to show the progress of mv, cp or rm a large file? (maybe percentage or speed of transfer)

Sometimes, when I try do something to a large file with one of those three commands, there is not way to know if it gets stack or not.

Last edited by kdar (2011-05-21 15:33:27)

Offline

#2 2011-05-21 16:56:35

mhertz
Member
From: Denmark
Registered: 2010-06-19
Posts: 681

Re: Progress bar for terminal? (for mv, cp, rm)

If you don't mind patching yourself: http://www.beatex.org/web/advancedcopy.html

Also, on the aur, there's something called ecp, which is an extended cp with mv functionality and progress-bar, but it's rather old...

Maybe others know a better solution...

Offline

#3 2011-05-21 17:19:09

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Progress bar for terminal? (for mv, cp, rm)

Offline

#4 2011-05-21 17:34:11

nous
Member
From: Across the Universe
Registered: 2006-08-18
Posts: 323
Website

Re: Progress bar for terminal? (for mv, cp, rm)

Offline

#5 2011-05-21 18:07:04

derFrank
Member
Registered: 2008-04-01
Posts: 6

Re: Progress bar for terminal? (for mv, cp, rm)

I once had an alias for rsync for this purpose. Can't find it right now, but must have been something like the following (iirc):

alias copy='rsync -r -v --progress'

Last edited by derFrank (2011-05-21 18:07:59)

Offline

#6 2011-05-21 18:07:41

teh
Member
From: Tijuana, Mexico
Registered: 2009-07-07
Posts: 374
Website

Re: Progress bar for terminal? (for mv, cp, rm)

1.

rsync -aP

2. A zsh function.
(strace required)

cp_p()
{
    strace -q -ewrite cp -- "${1}" "${2}" 2>&1 \
       | awk '{
         count += $NF
             if (count % 10 == 0) {
                percent = count / total_size * 100
                printf "%3d%% [", percent
                for (i=0;i<=percent;i++)
                   printf "="
                printf ">"
      
       for (i=percent;i<100;i++)
                   printf " "
                printf "]\r"
             }
          }
          END { print "" }' total_size=$(stat -c '%s' "${1}") count=0
}

3. A zsh function.
(pv required)

cp_p2() 
{ 
   if [ `echo "$2" | grep ".*\/$"` ]; then 
          pv "$1" > "$2""$1"; 
   else pv "$1" > "$2"/"$1"; 
   fi  ;     
}

arst

Offline

#7 2011-05-22 07:14:22

x33a
Forum Fellow
Registered: 2009-08-15
Posts: 4,587

Re: Progress bar for terminal? (for mv, cp, rm)

mhertz wrote:

If you don't mind patching yourself: http://www.beatex.org/web/advancedcopy.html
---snip---

This looks really good, as it's simply the original cp with the patch. I wonder why the GNU devs can't add something similar to cp and mv, as this feature has been in demand since forever.

Offline

#8 2011-08-29 03:56:26

invalidArgument597
Member
From: Ohio, United States
Registered: 2011-04-02
Posts: 37

Re: Progress bar for terminal? (for mv, cp, rm)

That Advanced Copy is in the AUR as 'advcp', which I just adopted: https://aur.archlinux.org/packages.php?ID=45056
I also had it install 'amv' so that we can have a 'mv' with the patch.


This account replaced by 'iv597'. Just can't delete old accounts on here...

Offline

Board footer

Powered by FluxBB