copy files/directory and show it by progress bar (zenity/kdialog)
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
1/ First, you copy the files, _THEN_ you run some loop doing what?
2/ Doesn't tcsh use double quotes around parameters?
3/ What's the condition for the while loop? $src >> $des. Is that a bit shift?
1/ First, you copy the files, _THEN_ you run some loop doing what?
2/ Doesn't tcsh use double quotes around parameters?
3/ What's the condition for the while loop? $src >> $des. Is that a bit shift?
1. loop should get the progress number and show it at zenity.
2. no error found so i guess yes.
3. don't understand the problem
bash not work for me and i still want to use tcsh.
1. loop should get the progress number and show it at zenity.
Progress of what? The copying is already finished by the time the loop starts.
Quote:
Originally Posted by DoME69
2. no error found so i guess yes.
My point is, if quoting in tcsh works as it does in bash, which I assume it does, your script will break whenever the filenames contain spaces. So you should put double quotes around all the variables like "$1", "$2", etc. If I'm wrong pleas somebody correct me.
Quote:
Originally Posted by DoME69
3. don't understand the problem
The problem is that the >> operator is a right shift (shifts bits in a variable to the right) in most languages (or a redirection). I believe in this context it would be the right shift. That doesn't make sense, maybe you meant $src > $des?
bash not work for me and i still want to use tcsh.
can anyone help?
I tried to help and you told me what you didn't want.
Now I don't want to help you.
If you are not willing to take direction, why are you asking for help?
As stated your copy command completes before the loop starts and the syntax for zenity is incorrect. I would base the progress on number of files copied versus directory size. The following is psuedo bash but I think it gets the basic idea across.
Code:
for (( x<$no_files_to _copy )); do
cp $file $destination
echo "$(( (x * 100) / no_files_to_copy ))"
done | zenity --progress \
--title="Copying Files to $destination" \
--text="$file" \
--percentage=0
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.