Re: The killer space!



On Feb 16, 2:26 pm, "Todd Vargo" <tlva...@xxxxxxxxxxxxxx> wrote:
Tom Lavedas wrote:
Todd Vargo wrote:
::BatchRename.cmd
@echo off
for /f %%i in ('dir /b') do call :rename "%%i"
goto :EOF
:rename
set NewName=%~n1
set NewName=0%NewName:Picture =%
set NewName=%NewName:~-2%
rename %1 %rolldate%%newname%%~x1
goto :EOF

Todd, I believe you were a bit hasty in your response. The double
quotes are only part of the answer. I think you were misled by the
unnecessary use of the 'dir /b' and the /F switch. The argument to
the rename subroutine will already be parsed at the space before it
arrives as a parameter to the subroutine call.

Good point. I forgot to remove /f and replace 'dir /b' with "Picture *.jpg"
to prevent reprocessing the same files (which will likely occur using
*.jpg).

--
Todd Vargo
(Post questions to group only. Remove "z" to email personal messages)

Right. A point that I missed.

Tom Lavedas
===========
.



Relevant Pages

  • 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: 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!
    ... goto:EOF ... rename %1 %rolldate%%newname%%~x1 ... Todd, I believe you were a bit hasty in your response. ...
    (microsoft.public.scripting.vbscript)
  • Re: Replacing a string in a filename
    ... and being able to rename that file into something else. ... IF EXIST %TO% GOTO:EOF ... Didn't know you could specify patterns to change in the Set command. ...
    (microsoft.public.win2000.cmdprompt.admin)
  • Re: [PATCH v5 04/16] PCI: prevent duplicate slot names
    ... We now rename these duplicate slots on behalf of the user. ... The hotplug driver creates the slot with its desired name, ... goto error_info; ... struct pci_bus of parent bridge ...
    (Linux-Kernel)