Re: sorting and naming files
The following should do approximately what you want:
$ i=1
$ for f in `ls | sort`
> do
> mv $f text${i}.txt
> i=`expr $i + 1`
> done
'man bash', 'man sort', and 'man expr' should give you some more
insight into what these commands do.
Marc
----------
Marc Mongeon <mongeon@bankoe.com>
Unix Specialist
Ban-Koe Systems
9100 W Bloomington Fwy
Bloomington, MN 55431-2200
(612)888-0123, x417 | FAX: (612)888-3344
----------
"It's such a fine line between clever and stupid."
-- David St. Hubbins and Nigel Tufnel of "Spinal Tap"
>>> "Alexander P. Barkey (hypnotic)" <a.p.barkey@hypnotic-noise.de> 11/24 8:04 PM >>>
hi
is there any way to sort and name the files in a directory?
for example...the files are all called like they have been downloaded...
now i want them to be like "text01.txt" "text02.txt" etc...
how can i do that?
thx
Alexander P. Barkey
Reply to: