-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Saturday, 2010-10-30 at 10:07 -0700, Randall R Schulz wrote:
On Saturday October 30 2010, Carlos E. R. wrote:
...
I simply write the names to a file, one file per line. Then a while loop reads them, one by one:
while read FILES ; do WorkOn "$FILES" done < $LISTOFFILES
I may be remembering the defaults incorrectly, but I'd reset IFS just to be sure spaces don't break the parse:
IFS= while read targetFile; do # Do stuff with the file whose name is held in "$targetFile" done <"fileListfile"
However, it is working for me :-) I wrote a script the other day to convert video files to .avi, and I'm using a loop like the one I said, sucesfully, without touching IFS. The trick is to surround each use of the variable with quotes. I suppose it will not work with new lines, but I have none of that. There is, however, a strange thing: while read FILES ; do ffmpeg whatever "$FILES" done < $LISTOFFILES only works on the first file and it exits, if there is a working call to ffmpeg. Aparently, ffmpeg somehow disrupts piping. So, instead I have to first read the file list to an array (bash), then loop over the array, not the input file.
You could use find with xargs, but you still have to access the disk several times.
Yes and no. In reality, the data structures holding the file system information will be cached by the kernel and making multiple passes over them has fairly low overhead.
Could be. If the OP says it takes days to run on those huge disks, then I would take the time to create a binary program to do the task. C. Me, pascal. The time to create the program is less than the running time of the script... - -- Cheers, Carlos E. R. (from 11.2 x86_64 "Emerald" at Telcontar) -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.12 (GNU/Linux) iEYEARECAAYFAkzQJIQACgkQtTMYHG2NR9WAgACfXuDXHlz4jtL2BajVhlg/Vcne +d8AnRjTFqp+JeTE7sZsEgrd5TgmXdky =9zow -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org