Here’s a little bash script I wrote that will copy files from my camera to the appropriate directory on my harddrive.
mount /dev/sdd1 /media/usb -t vfat
for f in $(find $picsrc -type f)
do target=$pictar/$(basename $f)
if [[ ! -e $target ]]
then cp $f $target
else cp $f $target-
It contains an if statement that makes sure it isn’t about to overwrite a file on the target directory. If so, it will copy the file as a new name (it appends the date to the name).
This script works great when I run it from bash - it doesn’t append anything the first time I run it and, when I run it again, does append as it should (since I’m copying the same files twice).
Trouble is, when I run it from Asterisk, it always appends the date even if there is no file name collision.
Anyone have any idea what’s going on?