On January 4, 2003 09:20 pm, the fabulous Gerald V. Livingston II wrote: > Thank you. Took a couple of tries to get the syntax correct but I > ended up with this: > > if [ `ls *.jpg 2>/dev/null|wc -l` -gt 0 ] > > then for i in *.jpg; do mmv "$i" `date +%s`-$a.jpg; a=a+1; done > > fi
If there were thousands of jpgs you'll probably still get a "too many arguments" error with that for loop. I usually do something like this: ls *.jpg | while read i; do mv "$i" `date +%s`-$a.jpg; a=a+1 done If there are no files, no problem, if there are 10,000 files also no problem (although there might be a faster way?). Fraser -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]