LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-11-2005, 06:00 PM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
CLI progress bar for mv and cp command???


is there any way to get some kind of progress indication when using the CLI for both the mv and cp commands?

i am looking for something that looks and or acts like the -h for an rpm. IIRC rpm -ivh or -Uvh will either install/update, verify, and give a #### indicator of its progress.

that would be very nice and handy when moving large files (50M plus) across the LAN or even just from one location on the system to an other.

thanks for the help.
 
Old 03-12-2005, 06:40 PM   #2
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
A few days ago I was thinking of the same thing, so I have kinda bumped this thread to find out if there is a solution out there.
 
Old 03-12-2005, 07:20 PM   #3
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
I came up with this example using dialog --guage from the net . I modified it abit to come up with the second example.
Code:
#!/bin/bash

files=`ls -l | wc -l`
copied=1
(
while [ $files -ge $copied ]
do
  pct=$((100 * copied / $files))
  echo $pct
  copied=$((copied + 1))
  sleep 1
done
) | dialog --title "Files tested" --gauge "" 5 30 
clear
Code:
#!/bin/bash

files=`ls -l | wc -l`
copied=1
clear
echo "                     Please wait, copy in progress"
while [ $files -ge $copied ] ;do
   pct=$((100 * copied / $files))
   copied=$((copied + 1))
   echo -en ".$pct%\b\b\b"  ## you can use # or anything instead of dots 
   sleep 1
done
  echo -e "\n"
  echo "                     The operation is complete"
  echo -e "\n"
 
Old 03-12-2005, 07:52 PM   #4
reddazz
LQ Guru
 
Registered: Nov 2003
Location: N. E. England
Distribution: Fedora, CentOS, Debian
Posts: 16,298

Rep: Reputation: 77
Thanks. I gotta learn some shell scripting, it would make system administration much easier for me.
 
Old 03-12-2005, 09:12 PM   #5
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 61
Scripting is one of those things I call "Miserable Fun" .
It can make you pull hair out and it can give you a feeling of accomplishment.

Also, it's worth noting those examples don't actually do anything.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to show a progress bar on the next line? Chowroc Programming 10 10-26-2005 10:27 PM
cp with progress bar? Rotwang Linux - General 5 04-27-2005 07:49 PM
Progress bar image craigs1987 Fedora 0 05-27-2004 02:31 PM
cp: progress bar chii-chan Linux - General 2 10-30-2003 06:30 PM
Progress Bar zael Programming 3 10-01-2003 12:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 02:32 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration