
October 3rd, 2003, 03:25 PM
|
|
Junior Member
|
|
Join Date: Oct 2003
Posts: 2
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Unix Script cannot copy filename with brackets
i am trying to write a bash script to backup recent files from a directory.
it works well, except that it does not copy files whose names have brackets.
(i.e. banner[1].jpg)
any advice on how i might be able to do this, or on code that would find and rename such files before i run my copy script?
thanks!
-matt
my script
____
#!/bin/sh
# this script will backup all files from the last month to a secondary location
date=$(date "+%m-%d-%y")
# mkdir backup_$date
cd /Volumes/192.168.1.15/apps/GoldMine/Mailbox/Attach/
find . -mtime 1 | \
while read file
do
#avoiding pesky trivial output
if [ "$file" = "." ]
then
else
echo "$file"
cp "$file" /Volumes/192.168.1.108/ScriptTest/backup_$date/"$file"
fi
done
|