i have shell script backs , restores calibration of scanner device.
code:
if [ "-backup" == "$1" ]; if [ ! -d $backupdir ]; mkdir -p $backupdir cp -r -d $home/syscan_docketport465 $backupdir/syscan_docketport465 cp -r -d $home/docucap_docketport467 $backupdir/docucap_docketport467 fi elif [ "-restore" == "$1" ]; if [ -d $backupdir ]; cp $backupdir/syscan_docketport465/* $home/syscan_docketport465/ cp $backupdir/docucap_docketport467/* $home/docucap_docketport467/ fi fi
right now, backs 2 folders, syscan_docketport465
, docucap_docketport467
. in these folders file called calibration.dat
.
what need now, make every folder follows *_docketport*
backed , restored every time new configuration docketport added, don't need edit script.
i have tried this:
if [ "-backup" == "$1" ]; if [ ! -d $backupdir ]; mkdir -p $backupdir cp -r -d $home/*_docketport* $backupdir fi elif [ "-restore" == "$1" ]; if [ -d $backupdir ]; cp -r -d $backupdir/*_docketport/* $home fi fi
for backup, works fine!
but restore keeps telling me can't overwrite created /home/path/calibrate.dat
/home/path/syscan_docketport465/calibration.dat
so basically, keeps putting calibration.dat
in /home/path/
instead of in /home/path/somedocucapfolder/
reason.
can me out?
your second cp
command has incorrect slash in *_docketport/*
. should *_docketport*
. try changing to:
cp -r -d $backupdir/*_docketport* $home
Comments
Post a Comment