Catatan

Sekedar catatan agar tidak lupa :)
Catatan ini merupakan shell script sh untuk mengkopi file-file yang terdapat dalam sebuah daftar list.
file dikopi dari direktori /file/penting ke direktori /penting/file/
namafile : copyfile.sh
daftar list file : list

#!/usr/bin/sh

for i in `cat ${1}`
do
cp /file/penting/”${i}” /penting/file/
echo “${i} berhasil di copy”
done

penggunaan : # ./copyfile.sh list

——-

UPDATE

——-

berikut script yang lebih baek :)

#!/usr/bin/sh
ASALA=/file/penting
TUJUAN=/penting/file
ASALB=/file2/penting

for i in `cat ${1}`
do
if
cp “${ASALA}”/”${i}” ${TUJUAN} ;
then echo “${i} berhasil di copy dari ${ASALA}”;
echo “———————-”;
else
if
cp “${ASALB}”/”${i}” “${TUJUAN}”;
then echo “${i} berhasil di copy dari ${ASALB}”;
echo “———————-”;
else
echo “${i} ORA KETEMU COY”;
fi
fi
done

September 17th, 2008 Posted in Learn

Leave a Reply

:wink: :-| :-x :twisted: :) 8-O :( :roll: :-P :oops: :-o :mrgreen: :lol: :idea: :-D :evil: :cry: 8) :arrow: :-? :?: :!:

Andhy S Perdana | Entries (RSS) | Comments (RSS).

Switch to our mobile site