Rename many files in subfolders

L

Lars

Hi group,

I know how to rename files from a cmd-prompt using
wildcards, but I can not find an appropriate switch do do
the job in subfolders.

Do you know?

Years ago when I frequently used Textpad for larger ASCII
files I thought it a good idea to save them with the
extension "txp". Since a couple of years now I have replaced
Windows Notepad with "Metapad" and I rarely feel any need
for Textpad.

I have hundreds of these *.txp's in well over a hundred
subfolders to My Documents. I would want them to remain in
their folders and retain their names except the very last
letter in the extension.

<Ren *.txp *.txt> works fine but only in that particular
folder.

I have a feeling I have done this on one computer but can
not remember how.


Lars
Stockholm
 
P

Phil Robyn [MVP]

Hi group,

I know how to rename files from a cmd-prompt using
wildcards, but I can not find an appropriate switch do do
the job in subfolders.

Do you know?

Years ago when I frequently used Textpad for larger ASCII
files I thought it a good idea to save them with the
extension "txp". Since a couple of years now I have replaced
Windows Notepad with "Metapad" and I rarely feel any need
for Textpad.

I have hundreds of these *.txp's in well over a hundred
subfolders to My Documents. I would want them to remain in
their folders and retain their names except the very last
letter in the extension.

<Ren *.txp *.txt> works fine but only in that particular
folder.

I have a feeling I have done this on one computer but can
not remember how.


Lars
Stockholm

From the CMD prompt:


for /r %a in (*.txp) do @echo ren "%a" "%~na.txt"


If this appears to do what you intend, remove '@echo'.
 
M

Mike

Hi,

What does the "%~na.txt" do?

Mike
--

Phil Robyn said:
From the CMD prompt:


for /r %a in (*.txp) do @echo ren "%a" "%~na.txt"


If this appears to do what you intend, remove '@echo'.

--
Phil Robyn
Univ. of California, Berkeley

u n z i p m y a d d r e s s t o s e n d e - m a i l
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top