While trying to migrate a friends web site tree to another machine I've come across a situation where I've found some illegal (at least for scripting) file/directory names.
In particular I've encountered a directory with the following name:
<img alt="HomepricevsPay.jpg" src="http:
Now - manually I can force this delete with wild cards but I have a script for repeatability and the area where I'm trying to delete this is failing as follows:
cannot access `public_html/columns/<img':
No such file or directory
cannot access `alt="HomepricevsPay.jpg"':
No such file or directory
cannot access `src="http:/No such file or directory
I'm sure you get the picture.
The script snippet I'm using is here:
# Remove any illegal file/directory names from tree
echo "Scanning for illegal directory/file names..."
find . -name "*<*" -print > tmp.1
sed -i "s/\ /\?/g" tmp.1
for x in $(cat tmp.1)
do
echo "Removing file/directory $x"
rm -rf $x*
done
rm -f tmp.1
So, if any of you guru's have a good idea/recommendation I would certainly appreciate a response. As always on this site - thank you all very much!
In particular I've encountered a directory with the following name:
<img alt="HomepricevsPay.jpg" src="http:
Now - manually I can force this delete with wild cards but I have a script for repeatability and the area where I'm trying to delete this is failing as follows:
cannot access `public_html/columns/<img':
No such file or directory
cannot access `alt="HomepricevsPay.jpg"':
No such file or directory
cannot access `src="http:/No such file or directory
I'm sure you get the picture.
The script snippet I'm using is here:
# Remove any illegal file/directory names from tree
echo "Scanning for illegal directory/file names..."
find . -name "*<*" -print > tmp.1
sed -i "s/\ /\?/g" tmp.1
for x in $(cat tmp.1)
do
echo "Removing file/directory $x"
rm -rf $x*
done
rm -f tmp.1
So, if any of you guru's have a good idea/recommendation I would certainly appreciate a response. As always on this site - thank you all very much!