Re: scripts for batch treatment
Bernard wrote:
> Hi to Everyone !
>
> I intend to copy a number of files chosen from a given directory. At
> first, I've made a mistake : instead of deleting unwanted files from a
> copy of said directory, I worked on deleting lines on a filelist that I
> had extracted
> using 'ls -l > filename.txt'. This sorting job, on about 12,500 lines,
> took several hours of my time, and I hope to find a way to make use of
> the result obtained, rather than re-doing the whole sorting job. The
> sorted files number about 400 or so. Had it been only 2 or 3 dozens of
> files, I would not have hesitated repeating the following command for
> each file :
>
> cp
> /mnt/exthd/home/bd/office52/user/desktop/etc/etc/filename_pasted_from_the_list
> /home/mydir
>
> But 400 files are too many, and I expect to be able to treat this, using
> some sort of a shell script suitable for batch treatment...
>
> A similar problem had occured to me 3 or 4 years ago for batch treatment
> of a series of picture files, and I had managed with a short Free Pascal
> routine using a 'for n=x to y do" loop, this being made possible by the
> fact that filenames were made of a rising set of numeric values, which
> is not the case for my new problem. Filenames are indeed made of long
> strings of characters since they are "subjects" of e-mails received via
> StarOffice 5.1 and 5.2.
>
> Thanks in advance for any hint.
>
> P.S. I know nothing about shell scripts, so I might need a good tutorial
> on this.
>
There's no need for shell scripting. Just use the commands available:
xargs -a list-of-files-to-copy -IFILE cp FILE /destination/path
--
spagmumps, n.:
Any of the millions of Styrofoam wads that accompany mail-order items.
-- "Sniglets", Rich Hall & Friends
Eduardo M KALINOWSKI
eduardo@kalinowski.com.br
Reply to: