grazinggoat
Programmer
I am trying to move files that have invalid characters out
of a directoy but the regex i am using is still copying
the good files that i want to keep in the log_dir
files can be like this
bill-0001.log
BILL-0120-.log
Bill-A-1234-Nov.log
The problem is those files are still being moved
can someone tell me what I am doing wrong here with my regex?
thnx inadvance!
[pre]for FILENAMES in `ls log_dir`
do
if [[ "$FILENAMES" == ^[a-zA-Z0-9.-_]+$ ]] ; then
#do nothing file is good
:
else
#badfile name
print "Found invalid file ${FILENAMES}"
mv "${FILENAMES}" /tmp/
fi
done
[/pre]
of a directoy but the regex i am using is still copying
the good files that i want to keep in the log_dir
files can be like this
bill-0001.log
BILL-0120-.log
Bill-A-1234-Nov.log
The problem is those files are still being moved
can someone tell me what I am doing wrong here with my regex?
thnx inadvance!
[pre]for FILENAMES in `ls log_dir`
do
if [[ "$FILENAMES" == ^[a-zA-Z0-9.-_]+$ ]] ; then
#do nothing file is good
:
else
#badfile name
print "Found invalid file ${FILENAMES}"
mv "${FILENAMES}" /tmp/
fi
done
[/pre]