I am using a simple bash script to read files from an FTP server, convert to dos format and then move to another folder:
#!/bin/bash
SOURCE="$1"
DESTINATION="$2"
# Use globbing to grab list of files
for x in $1/*.txt; do
f=$(basename $x)
todos $x
echo "Moving $x to $DESTINATION/$f"
mv $x $DESTINATION/$f
done
A really simple question - how do I stop the loop executing when there are no txt files to be moved?