I am trying to rename a complete directory of
files to remove the first three characters. All
the filenames have spaces throughout them
and the first several characters look like this:
"01 Filename hour 1.mp3"
"02 Filename hour 2.mp3"
"03 Filename hour 3.mp3"
I want to remove the initial numbers (ex: "01 ")
This is the code I have so far:
for %%a in (*.mp3) do call :process "%%a"
ren "%fileName%" "%fileName:~4%"
It works great with one exception: the first file
processed is not renamed correctly.
Here is what was echoed to the command
prompt when the first file was processed:
ren "01 Fri, August 21st, 2009 Hour 1.mp3"
"Fri, August 21st, 2009 Hour 1.mp3"
The actual name the file ended up with was:
", August 21st, 2009 Hour 1.mp3"
I tried to remove the weekday, comma, and
space to give all files names like
"August 21st, 2009 Hour 1.mp3" instead
(changed the 4 to a 9 in the batch script). In
that case the first file processed ended up with
the following name:
"1st, 2009 Hour 1.mp3"
I also tried to remove the August 21st Hour 1
file to see if that particular file was the
problem. The first file continued to be the only
one named incorrectly.
If anyone can help I'd appreciate it. I'm also
curious why using a 1 instead of a 4 in the
rename command (such as %fileName:~1%)
does not remove a single character from any