writing script to create backup of file by adding datetime to file name. Basically test for file presence
if there, cp with datetime
then rm original
cp works fine from command line but get
cannot stat `full path to file': No such file or directory
for a in CVP_dadamail; do
if [ -f $f2bu ]; then
cp $f2bu $backup
here are the errors:
cp: cannot stat `~/html/CVP_dadamail/.dada_files/.logs/errors.txt': No such file or directory
rm: cannot remove `...': No such file or directory
The for statement is a placeholder as I have same file to backup out of several directories.
using "bash -x scriptname" -OR- inserting echos, I can see I've constructed the strings properly. Believing it might be related to the hidden directories, I tried setting the shopt "glob" options to no avail.
Ultimately I'll add the other directories to the for loop and then run this from a cron job, so if you see potential pitfalls knowing I'm headed in that direction...
believe construct would be
for a in dir1 dir2 dir3; do
Thanks for looking...