Hello friends,
I am writing a simple shell script which will copy one particular type of files to backup folder if files exists. If files doesn't exists, mv command should not be executed.
My file pattern is like wcm-spider-maestro.log.2009-07-15, wcm-spider-maestro.log.2009-07-16 etc..
I have written this way
find . -maxdepth 1 -name "wcm-spider-maestro.log."
code=$?
if [$code -eq "0"]
then
mv wcm-spider-maestro.log. /backup
fi
above code working fine if files exists on current directory, if files doesn't exists, it showing message like "mv: cannot stat `wcm-spider-maestro.log.*': No such file or directory", I don't want to show that message. I tried with "ls" command also, it is also throwing some message if files not exists.
Please suggest me how to move files without error messages.
Thanks.