vick Julius wrote: > > for dir in ABC DEF GHI ; do > > for file in `(cd "$dir" && echo *.jpg)` ; do > > mv "$dir/$file" "Photos/${file%%.jpg}$dir.jpg" > > done > > done > > > What is the use of echo *.jpg in (cd "$dir" && echo *.jpg)? That fragment outputs the list of files in the current directory (which will be $dir due to the preceding "cd"). > Is it mandatory? There are other ways to do it; e.g. using "ls *.jpg" would also have worked, but "echo" is built in to the shell. > Where can I find more details on ${file%%.jpg} stuff? is it in the bash > manual?... It's in the bash manual, in the section entitled "Parameter Expansion". -- Glynn Clements <glynn@xxxxxxxxxxxxxxxxxx> - : send the line "unsubscribe linux-admin" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html