Quote:
Originally Posted by CRC123
Code:
for looper in `ls <directory>`
do
mv $looper "this.$looper"
done
|
Not to be picky, but this has a little problem: quote the variables, unless you are certain that they will contain no special characters (like spaces, for example).
Code:
for looper in `ls <directory>`
do
mv "$looper" "this.$looper"
done
Otherwise you are going to have problems if any files name has spaces.
Besides that, if you are using bash there's no need to use ls (and it can save you some pain sometimes to avoid it):
Code:
for looper in "/directory/"*
do
mv "$looper" "this.$looper"
done