Hi experts - I hate to admit that my DOS skills have all but abandoned me over the years. What I'm trying to do doesn't sound that difficult, but the 'rename' command is failing me.
I have a directory of a couple hundred .jpg files. Their naming convention is something like this:
dppp2.jpg
djdjj3.jpg
dljdkf8.jpg
dlkdklfj9.jpg
No real size pattern, but they all begin with a 'd' and end with a number, and are all .jpg.
I need to add an 's' to the end of every file. So my examples would look like this:
dppp2s.jpg
djdjj3s.jpg
dljdkf8s.jpg
dlkdklfj9s.jpg
I've tried the following command:
rename d*.jpg d*s.jpg
That clearly is not right. Can anyone help out here?
Thanx in advance.
-TS
renaming contents of directory ...
Moderator: DosItHelp
Re: renaming contents of directory ...
Use this command line and then examine renfiles.bat and run it if you are happy with it.
Code: Select all
for %a in (*.jpg) do @echo ren "%a" "%~nas%~xa" >>renfiles.bat
-
- Posts: 2
- Joined: 22 Feb 2014 18:37
Re: renaming contents of directory ...
foxidrive wrote:Use this command line and then examine renfiles.bat and run it if you are happy with it.Code: Select all
for %a in (*.jpg) do @echo ren "%a" "%~nas%~xa" >>renfiles.bat
This was exactly what I was looking for. Worked perfectly.
Thanx, foxidrive!
-TS