[K12OSN] Refining the script....more help? *please?*

David Trask dtrask at vcs.u52.k12.me.us
Mon Nov 22 04:12:43 UTC 2004


The script I need hellp with is below.  My latest hurdle....this script
works great (the first time)...if I try to run it again it pauses for
every file to ask my if I want to overwrite it.  I'd like to be able to
run it every now and then to copy my users files from their Windows
profile to their home directory to preserve the data and back it up.  How
can I run it and have it overwrite no matter what or at least have it
replace if the file being copied is newer?  I'd hate to have to keep my
finger on the "y" key the whole time  ;-)  Any ideas welcomed.....

!#/bin/bash
for x in `ls /home`; do
echo "Doing $x ..."
mkdir /home/${x}/win-backup
chown ${x}.Users /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/My\ Documents/
/home/${x}/win-backup"
cp -Rf  /opt/samba/profiles/${x}/My\ Documents/ /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup"
cp -Rf /opt/samba/profiles/${x}/Desktop/ /home/${x}/win-backup

echo "Copying /opt/samba/profiles/${x}/Favorites/ /home/${x}/win-backup"
cp -Rf /opt/samba/profiles/${x}/Favorites/ /home/${x}/win-backup

chown -R ${x}.Users /home/${x}/win-backup

done


David N. Trask
Technology Teacher/Coordinator
Vassalboro Community School
dtrask at vcs.u52.k12.me.us
(207)923-3100




More information about the K12OSN mailing list