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

Clip to copy and rename files

Expand Messages
  • Mike Breiding - Morgantown WV
    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
    Message 1 of 10 , May 28, 2011
    • 0 Attachment
      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.

      So, the copies would be renamed thus:

      d1.jpg
      d1.jpg
      d1.jpg

      d2.jpg
      d2.jpg
      d2.jpg

      etc.

      Any ideas?

      Thanks,
      -Mike

      ============================================
      Folder PATH listing for volume 500gigHitac
      Volume serial number is C8D4-EE9A
      C:.

      d1
      ext_links
      hres
      orig

      d2
      ext_links
      hres
      not
      orig

      d3
      ext_links
      hres
      not
      orig
    • diodeom
      ... Here s one of the ways to do it. Please make sure beforehand that c: all_files exists. ^!Set %d%=0 ... ^!Set %f%=0 ^!Inc %d% ^!IfPathExist c: d^%d%
      Message 2 of 10 , May 28, 2011
      • 0 Attachment
        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
      • diodeom
        ... These two lines could be reduced to: ^!RenameFile c: d^%d% orig ^%name% c: all_files d^%d%_^%name%
        Message 3 of 10 , May 28, 2011
        • 0 Attachment
          I wrote:
          >
          > ^!CopyFile "c:\d^%d%\orig\^%name%" "c:\all_files"
          > ^!RenameFile "c:\all_files\^%name%" "c:\all_files\d^%d%_^%name%"
          >

          These two lines could be reduced to:

          ^!RenameFile "c:\d^%d%\orig\^%name%" "c:\all_files\d^%d%_^%name%"
        • diodeom
          ... I swallowed the important part of this message: ...if you d like to remove the originals at the same time.
          Message 4 of 10 , May 28, 2011
          • 0 Attachment
            I wrote:
            >
            > These two lines could be reduced to:
            >
            > ^!RenameFile "c:\d^%d%\orig\^%name%" "c:\all_files\d^%d%_^%name%"
            >

            I swallowed the important part of this message: ...if you'd like to remove the originals at the same time.
          • Mike Breiding - Morgantown WV
            ... I cannot get this to do anything. When I added the clip below to NT 6.12 with Add from Clipboard or Add New Clip . The clip is created but when I click
            Message 5 of 10 , May 29, 2011
            • 0 Attachment
              On 5/28/2011 5:15 PM, diodeom wrote:
              > 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.


              I cannot get this to do anything.
              When I added the clip below to NT 6.12 with "Add from Clipboard" or "Add
              New Clip".
              The clip is created but when I click on the clip, nothing happens.

              What am I missing?
              Thanks for the help.
              -Mike


              >
              > ^!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
            • Alec Burgess
              Mike: just a guess but perhaps c: d^%d% in: ^!IfPathExist c: d^%d% File_Loop Else End does not exist. Insert ^!setdebug ON and step through one line at time.
              Message 6 of 10 , May 29, 2011
              • 0 Attachment
                Mike: just a guess but perhaps

                c:\d^%d% in:
                ^!IfPathExist "c:\d^%d%" File_Loop Else End

                does not exist. Insert ^!setdebug ON and step through one line at time.

                Regards ... Alec

                On 2011-05-29 06:29, Mike Breiding - Morgantown WV wrote:
                > On 5/28/2011 5:15 PM, diodeom wrote:
                >> 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.
                >
                > I cannot get this to do anything.
                > When I added the clip below to NT 6.12 with "Add from Clipboard" or "Add
                > New Clip".
                > The clip is created but when I click on the clip, nothing happens.
                >
                > What am I missing?
                > Thanks for the help.
                > -Mike
                >
                >
                >> ^!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
                >
                > ------------------------------------
                >
                > Fookes Software: http://www.fookes.com/
                > NoteTab website: http://www.notetab.com/
                > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                >
                > ***
                > Yahoo! Groups Links
                >
                >
                >
                >
              • John Shotsky
                It looks like there may be a wrapped line or two. Below, the indicates the actual starts of lines. ... Regards, John ... From: ntb-clips@yahoogroups.com
                Message 7 of 10 , May 29, 2011
                • 0 Attachment
                  It looks like there may be a wrapped line or two.
                  Below, the > indicates the actual starts of lines.
                  > ^!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
                  Regards,
                  John


                  -----Original Message-----
                  From: ntb-clips@yahoogroups.com [mailto:ntb-clips@yahoogroups.com] On Behalf Of Mike Breiding - Morgantown WV
                  Sent: Sunday, May 29, 2011 03:29
                  To: ntb-clips@yahoogroups.com
                  Cc: diodeom
                  Subject: Re: [Clip] Re: Clip to copy and rename files

                  On 5/28/2011 5:15 PM, diodeom wrote:
                  > 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.


                  I cannot get this to do anything.
                  When I added the clip below to NT 6.12 with "Add from Clipboard" or "Add New Clip".
                  The clip is created but when I click on the clip, nothing happens.

                  What am I missing?
                  Thanks for the help.
                  -Mike


                  >
                  > ^!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


                  ------------------------------------

                  Fookes Software: http://www.fookes.com/
                  NoteTab website: http://www.notetab.com/ NoteTab Discussion Lists: http://www.notetab.com/groups.php

                  ***
                  Yahoo! Groups Links
                • Mike Breiding - Morgantown WV
                  ... I did as you suggest, but I have never used DeBug so I am not sure what the behaviour should be. When run with debub it give a continue prompt through line
                  Message 8 of 10 , May 29, 2011
                  • 0 Attachment
                    On 5/29/2011 6:50 AM, Alec Burgess wrote:
                    > Mike: just a guess but perhaps
                    >
                    > c:\d^%d% in:
                    > ^!IfPathExist "c:\d^%d%" File_Loop Else End
                    >
                    > does not exist. Insert ^!setdebug ON and step through one line at time.
                    >
                    > Regards ... Alec

                    I did as you suggest, but I have never used DeBug so I am not sure what
                    the behaviour should be.

                    When run with debub it give a continue prompt through line 6 and then
                    ends the clip.
                    Thanks,
                    -Mike
                    p.s.
                    I place !setdebug ON as the first line



                    >
                    > On 2011-05-29 06:29, Mike Breiding - Morgantown WV wrote:
                    >> On 5/28/2011 5:15 PM, diodeom wrote:
                    >>> 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.
                    >>
                    >> I cannot get this to do anything.
                    >> When I added the clip below to NT 6.12 with "Add from Clipboard" or "Add
                    >> New Clip".
                    >> The clip is created but when I click on the clip, nothing happens.
                    >>
                    >> What am I missing?
                    >> Thanks for the help.
                    >> -Mike
                    >>
                    >>
                    >>> ^!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
                    >>
                    >> ------------------------------------
                    >>
                    >> Fookes Software: http://www.fookes.com/
                    >> NoteTab website: http://www.notetab.com/
                    >> NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >>
                    >> ***
                    >> Yahoo! Groups Links
                    >>
                    >>
                    >>
                    >>
                    >
                    >
                    > ------------------------------------
                    >
                    > Fookes Software: http://www.fookes.com/
                    > NoteTab website: http://www.notetab.com/
                    > NoteTab Discussion Lists: http://www.notetab.com/groups.php
                    >
                    > ***
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    >
                  • Axel Berger
                    ... Unless I ve miscounted the last line executed will be ^!IfPathExist c: d^%d% File_Loop Else End It looks like Alec has guessed right and that path does
                    Message 9 of 10 , May 29, 2011
                    • 0 Attachment
                      Mike Breiding - Morgantown WV wrote:
                      > When run with debub it give a continue prompt through line 6 and then
                      > ends the clip.

                      Unless I've miscounted the last line executed will be
                      ^!IfPathExist "c:\d^%d%" File_Loop Else End

                      It looks like Alec has guessed right and that path does not exist.

                      Axel
                    • Mike Breiding - Morgantown WV
                      ... Duh... I get it now. I moved a couple of the d* folders to c: and it works! I changed the path for in the clip to the one I was using and it ran through
                      Message 10 of 10 , May 29, 2011
                      • 0 Attachment
                        On 5/29/2011 11:28 AM, Axel Berger wrote:
                        > Mike Breiding - Morgantown WV wrote:
                        > > When run with debub it give a continue prompt through line 6 and then
                        > > ends the clip.
                        >
                        > Unless I've miscounted the last line executed will be
                        > ^!IfPathExist "c:\d^%d%" File_Loop Else End
                        >
                        > It looks like Alec has guessed right and that path does not exist.

                        Duh...
                        I get it now.
                        I moved a couple of the d* folders to c:\ and it works!

                        I changed the path for in the clip to the one I was using and it ran
                        through all the 23 d* folders lickity-split!! 2.3 gig of files.

                        Thanks Diodeom and everyone else for their help.
                        Beats the h*ll outta doing it manually!!

                        -Mike
                      Your message has been successfully submitted and would be delivered to recipients shortly.