Click to See Complete Forum and Search --> : Script help(bash, perl, whatever)


david
11-06-2000, 08:23 PM
Okay, redid win partition on 15gig hd that had mp3's on it, it was screwed up REAL bad. anywho, i did an "ls" of the dir because all our mp3's are on cd's, and my brother went thru them all and put some of them on the hd(faster than changing cd's http://www.linuxnewbie.org/ubb/smile.gif ).

Anywho, what i have to do now:
make a script that goes thru each line of the file with all the mp3s, and do "cp file /mnt/win3"
where file would be each line. i would execute this from the cd, on each, so it would copy whatever mp3's that were on the hd from that cd back on the hd.

_OR_

is there any way i could get "cp" to read stdout? eg/
cat mp3e | cp (stdout) /mnt/win3

(mp3e is the file with the list of mp3's)

is there anything i can put as source so it reads the stdout?

------------------
-David
Linux user since June, 2000
"Only forest fires prevent bears"
"Kids in the back seat cause accidents,
accidents in the back seat cause kids"
:D :D

bsh152s
11-07-2000, 07:22 PM
Do you know C? I'm not too familiar with perl. With C, you could write a simple script using the system(const char *string) call. All it does is executes the string like sh would. So, read from stdin the file (cat listfile > Cscript). And, in your C program, you would have to extract out the filenames.

david
11-08-2000, 12:23 PM
Don't know anything about C. I think I might be able to do it with a php script