Loading ...
Sorry, an error occurred while loading the content.

21797Re: Clip to copy and rename files

Expand Messages
  • diodeom
    May 28, 2011
      Mike Breiding wrote:
      >
      > Below is part of a folder tree.
      > In each folder named "orig" are .jpg files named in sequence:
      > photo0000001.jpg
      > photo0000002.jpg
      > photo0000003.jpg
      > etc.
      > The parent folder for "orig" is "d1", "d2", "d3", etc.
      >
      > What I would like to accomplish is to copy all files in the "orig"
      > folders, to an "all_files" folder and have them renamed after the "d*"
      > directory.
      >

      Here's one of the ways to do it. Please make sure beforehand that "c:\all_files" exists.

      ^!Set %d%=0
      :Dir_Loop
      ^!Set %f%=0
      ^!Inc %d%
      ^!IfPathExist "c:\d^%d%" File_Loop Else End
      :File_Loop
      ^!Inc %f%
      ^!Set %name%=photo^$StrCopyRight("000000^%f%";7)$.jpg
      ^!IfFileExist "c:\d^%d%\orig\^%name%" Next Else Dir_Loop
      ^!CopyFile "c:\d^%d%\orig\^%name%" "c:\all_files"
      ^!RenameFile "c:\all_files\^%name%" "c:\all_files\d^%d%_^%name%"
      ^!Goto File_Loop
    • Show all 10 messages in this topic