-   Linux - Newbie (
-   -   Copy command to show progress bar or status (

sudo_su 08-03-2013 03:39 PM

Copy command to show progress bar or status
Dear members,

1: I want to see the progress of the copying process, how much done how much left and even if the system is hanged and i am waiting like a stupid :S

2: How can I see the size of a directory with ls command. I use

ls -lh
but it only shows the size of file not directories.

Please assist.

schneidz 08-03-2013 03:44 PM

man du to see the size of dirs.

i think you can program something with dialog/zenity to count the progress of file transfers.

sudo_su 08-03-2013 03:49 PM

thanks Schneidz.

got that du.

for the second part, isn't it something built-in like we use with rpms say

rpm -ivh
and that shows the process bar.

schneidz 08-03-2013 03:51 PM

not that i know of. i know that scp shows a progress bar but only during network transfers.

sycamorex 08-03-2013 04:14 PM

What about rsync?

or pv

Firerat 08-03-2013 04:16 PM

rsync can do local, and show --progress
but I have never really paid much attention to it, I think it might be per file and not the whole batch.

This is a script I use for sending files to Android.

Obviously no good for what you want, but adapt to use du instead of stat"



for FILE in $@;do
    SIZE=$( stat -c %s $FILE )
    file=$( basename $FILE )
    adb shell 'grep -q sdcard /proc/mounts || mount /sdcard'
    echo "Pushing $FILE to $TargetDir/$file"
    coproc ADB_PUSH ( set +m
                      adb push $FILE $TargetDir/$file 2> /dev/null || \
                      echo "Error: failed"
                      set -m
    until [ "$ADB_PUSH_PID" = "" ];do
        sleep 1
        adb shell stat -t $TargetDir/$file | \
        awk '{printf "\r[ %5.1f%% ] ( %s/%s )",($2/'$SIZE')*100,$2/1024,'$SIZE'/1024}'
    echo ""

All times are GMT -5. The time now is 05:21 PM.