ITEM: H0012L
How can I rename a group of files?
Question:
I have about 1000 files with the extension of .DST. I want to change
that extension as .dst. These files are in the same directory. And
they do have different names at the beginning of the filename. Is
there a way to do this?
Response:
This will accomplish the renaming of the files:
$ cd \
$ ls *.DST | sed 's/\\([\^.]*\\)\\.DST/mv \\1.DST \\1.dst/' | sh -v
The stream editor will search for all files that do not begin with a
dot and have the extension "DST." The file name, minus the extension,
will be stored in a temporary register "1". The contents of that register
will be everything set off by \\(...\\). Next, sed will replace each line
of input with a new line that contains "mv \.DST \.dst"
and then pipe it to the sh command where it will be executed. The -v
option simply says, execute this in verbose mode so I can see what's
happening.
Support Line: How can I rename a group of files? ITEM: H0012L
Dated: April 1994 Category: N/A
This HTML file was generated 99/06/24~13:30:49
Comments or suggestions?
Contact us