Code:
for file in <directory>/*
do
echo $file
mv -f $file <another dir>
done
The is a problem with this
for loop : if the directory is empty body of the loop is executed nevertheless with the variable file set to '<directory>/*'
Another solution with the
for loop :
Code:
for file in `ls -1 <directory>/* 2>/dev/null'
do
echo $file
mv -f $file <another dir>
done
You can also use a
while loop :
Code:
ls -1 <directory>/* 2>/dev/null | \
while read file
echo $file
mv -f $file <another dir>
done
Jean-Pierre.