The killer space!



A friend created a .bat file for me so I could easily rename files I
download from a photo site. The site names each file: Picture_1.jpg
and I want to rename them to follow a date-roll-shot number:
2008-02-15-01-01.

So here's the script:
------
::BatchRename.cmd
@echo off
for /f %%i in ('dir /b') do call :rename %%i
goto :EOF
:rename
set Oldname=%1
set NewName=%oldname:Picture_=2006-08-16-03-%
rename %oldName% %newname%
goto :EOF
------

Then the photo site changed the way they named the individual files.
So instead of "Picture_1.jpg" there is now a space instead of the
underline so it reads "Picture 1.jpg".

And the script doesn't work anymore.

Could some one help me update the .bat file so it can handle the empty
space?

Thanks in advance!

Pete
.



Relevant Pages

  • Re: The killer space!
    ... and I want to rename them to follow a date-roll-shot number: ... goto:EOF ... Then the photo site changed the way they named the individual files. ...
    (microsoft.public.scripting.vbscript)
  • Re: The killer space!
    ... and I want to rename them to follow a date-roll-shot number: ... @echo off ... goto:EOF ...
    (microsoft.public.scripting.vbscript)
  • Re: Is there something basic that I have missed on the upgrade to VS2005?
    ... > STL code I am using. ... It is not ADO by any chance? ... With ADO you do have to "rename" EOF as it confuses EOF as ...
    (microsoft.public.vc.stl)
  • Re: running a bat file
    ... Why not just use VBA commands, rather than bothering with a .BAT file? ... To delete a file, use the Kill statement: ... To rename a file, use the Name statement: ... > Dim x ...
    (microsoft.public.access.tablesdbdesign)
  • Re: The killer space!
    ... goto:EOF ... rename %1 %rolldate%%newname%%~x1 ... the rename subroutine will already be parsed at the space before it ...
    (microsoft.public.scripting.vbscript)

Loading