I would like to use the file_list because I'm using a kdialog script. It
creates a progress bar.
I run find
Then I count the lines inside the file_list
that gives my progress bar a final number, then for each file it copies, it
counts by one, progressing the bar...
It's kind of lame, but I have a ton of files and sometimes backups can take
hours. But my wife, parents, friends who do the same type of thing, just
don't like the command line, so I wrote a quick bash script to show the
pretty progress bar. It's really quite nice.
Nathan
On Saturday 12 February 2005 10:13, Eric "Shubes" wrote:
> Lee Einer wrote:
> > Nathan England wrote:
> >> I am trying to make a script that copies files from one directory to
> >> another.
> >> The problem is, some files have a space in between the names, think
> >> "My Documents"
> >>
> >> I need a way in bash to copy a file from one directory to another.
> >> At the same time, I need to be able to count the files.
> >>
> >> Currently, I'm trying something like this.
> >>
> >> find . | tee file_list
> >> while read file
> >> do
> >> cp -ruv $file $TMP/backup
> >> done < file_list
> >>
> >> This works great, but files such as "My Documents" can not be found by
> >> cp. It sees it as My and Documents.
> >>
> >> I thought there was a way to get find to report the space with a
> >> leading \ but I can't find that and I forgot how I did it before. Can
> >> anyone help with this?
> >> I greatly appreciate it!
> >>
> >> Nathan
> >> ---------------------------------------------------
> >
> > Have you tried actually using double quotes as in "My Documents?" That
> > should prevent the shell from reading the whitespace as a separation
> > between two distinct terms.
> > --
> > Lee Einer
> > Dos Manos Jewelry
> > http://www.dosmanosjewelry.com
>
> That should fix it all right.
>
> The find command is quite powerful once you get to know it. If you don't
> need the file list for some other purpose, you could simply:
> find . -exec cp -ruv {} $TMP/backup \;
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.plug.phoenix.az.us
To subscribe, unsubscribe, or to change you mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss