Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. DOS question

DOS question

Scheduled Pinned Locked Moved The Lounge
questionhelp
43 Posts 35 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Bassam Abdul Baki

    Best tool ever.[^]

    R Offline
    R Offline
    Rajesh R Subramanian
    wrote on last edited by
    #9

    +1 for BRU! It works great. :)

    There are some really weird people on this planet - MIM.

    D 1 Reply Last reply
    0
    • R Russell

      I have to rename in some folders many file. The file are named like:

      L1.txt
      L2.txt
      ...
      L9.txt
      L10.txt
      ...
      L99.txt
      L100.txt
      ...

      Now, to apply some code, I need that the names changes to

      L001.txt
      ...
      L009.txt
      L010.txt
      ...
      L099.txt
      L100.txt

      I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

      rename L?.txt L00?.txt
      rename L??.txt L0??.txt

      but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


      Russell

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #10

      The answer as always: Total Commander. It has a very nice file renaming tool. :)

      xacc.ide
      IronScheme - 1.0 RC 1 - out now!
      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

      M P 2 Replies Last reply
      0
      • L leppie

        The answer as always: Total Commander. It has a very nice file renaming tool. :)

        xacc.ide
        IronScheme - 1.0 RC 1 - out now!
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

        M Offline
        M Offline
        megaadam
        wrote on last edited by
        #11

        Bingo! :) When I first saw (Windows a.k.a.) Total Commander, I used to sneer at it. But that was a long time ago. Now, I never look at whatsitcalled included with windows.

        ..................... Life is too shor

        N 1 Reply Last reply
        0
        • R Russell

          I have to rename in some folders many file. The file are named like:

          L1.txt
          L2.txt
          ...
          L9.txt
          L10.txt
          ...
          L99.txt
          L100.txt
          ...

          Now, to apply some code, I need that the names changes to

          L001.txt
          ...
          L009.txt
          L010.txt
          ...
          L099.txt
          L100.txt

          I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

          rename L?.txt L00?.txt
          rename L??.txt L0??.txt

          but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


          Russell

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #12

          Russell' wrote:

          any expert on the 'old' DOS?

          Looks to be some good stuff here.

          "One man's wage rise is another man's price increase." - Harold Wilson

          "Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons

          "Man who follows car will be exhausted." - Confucius

          1 Reply Last reply
          0
          • L leppie

            The answer as always: Total Commander. It has a very nice file renaming tool. :)

            xacc.ide
            IronScheme - 1.0 RC 1 - out now!
            ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x))) The Scheme Programming Language – Fourth Edition

            P Offline
            P Offline
            puromtec1
            wrote on last edited by
            #13

            Its home page is classic. It has the old style page counter, mentions Windows 3.1 and has a picture of a floppy disk on it.

            1 Reply Last reply
            0
            • R Russell

              I have to rename in some folders many file. The file are named like:

              L1.txt
              L2.txt
              ...
              L9.txt
              L10.txt
              ...
              L99.txt
              L100.txt
              ...

              Now, to apply some code, I need that the names changes to

              L001.txt
              ...
              L009.txt
              L010.txt
              ...
              L099.txt
              L100.txt

              I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

              rename L?.txt L00?.txt
              rename L??.txt L0??.txt

              but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


              Russell

              S Offline
              S Offline
              Snowman58
              wrote on last edited by
              #14

              Flash Renamer - http://www.rlvision.com/downloads.asp[^]

              Melting Away www.deals-house.com www.innovative--concepts.com

              1 Reply Last reply
              0
              • R Russell

                I have to rename in some folders many file. The file are named like:

                L1.txt
                L2.txt
                ...
                L9.txt
                L10.txt
                ...
                L99.txt
                L100.txt
                ...

                Now, to apply some code, I need that the names changes to

                L001.txt
                ...
                L009.txt
                L010.txt
                ...
                L099.txt
                L100.txt

                I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                rename L?.txt L00?.txt
                rename L??.txt L0??.txt

                but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                Russell

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #15

                Kind of old school, but for tasks like this, I'll fire up my spreadsheet program of choice and build individual statements using simple formulas and cell formatting. Once you have a column of commands, you can copy them and paste them into the command prompt and they'll run one at a time. Not as cool as PowerShell or some of the other better answers, but it gets the job done.

                Joe Enos joe@jtenos.com

                L 1 Reply Last reply
                0
                • L Lost User

                  Kind of old school, but for tasks like this, I'll fire up my spreadsheet program of choice and build individual statements using simple formulas and cell formatting. Once you have a column of commands, you can copy them and paste them into the command prompt and they'll run one at a time. Not as cool as PowerShell or some of the other better answers, but it gets the job done.

                  Joe Enos joe@jtenos.com

                  L Offline
                  L Offline
                  Larry G Grimes
                  wrote on last edited by
                  #16

                  Joe has the best answer on this one.

                  N 1 Reply Last reply
                  0
                  • R Russell

                    I have to rename in some folders many file. The file are named like:

                    L1.txt
                    L2.txt
                    ...
                    L9.txt
                    L10.txt
                    ...
                    L99.txt
                    L100.txt
                    ...

                    Now, to apply some code, I need that the names changes to

                    L001.txt
                    ...
                    L009.txt
                    L010.txt
                    ...
                    L099.txt
                    L100.txt

                    I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                    rename L?.txt L00?.txt
                    rename L??.txt L0??.txt

                    but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                    Russell

                    M Offline
                    M Offline
                    Mike Winiberg
                    wrote on last edited by
                    #17

                    Hmm, multiple tools available really, depending on budget and the amount of effort you want to use: ZTREE (remember Xtree for DOS), ZTree is based on this, is still being developed and sold, and has none of the memory limits of the old DOS Xtree, seing as how its a Windows 32bit console app. Otherwise look at XXCOPY if you want something that runs in a window, DirectoryOpus or Powerdesk for native windows GUI. If you want 'free', then Powershell would be a good start, or one of the many 'Norton Commander' clones out there.

                    V 1 Reply Last reply
                    0
                    • R Russell

                      I have to rename in some folders many file. The file are named like:

                      L1.txt
                      L2.txt
                      ...
                      L9.txt
                      L10.txt
                      ...
                      L99.txt
                      L100.txt
                      ...

                      Now, to apply some code, I need that the names changes to

                      L001.txt
                      ...
                      L009.txt
                      L010.txt
                      ...
                      L099.txt
                      L100.txt

                      I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                      rename L?.txt L00?.txt
                      rename L??.txt L0??.txt

                      but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                      Russell

                      D Offline
                      D Offline
                      dchuks
                      wrote on last edited by
                      #18

                      Use the following script. It does the following: For each *.txt file in the current directory... 1. remove the first character, assuming it is an L 2. add 00 to the front 3. extracts the last 7 characters XXX.txt, where XXX is the original number padded with zeros 4. adds the L back to the front 5. does the rename

                      @echo off
                      setlocal ENABLEDELAYEDEXPANSION
                      for /f "delims=" %%a in ('dir /b *.txt') do (
                      (set i=%%a)
                      (set i=00!i:~1,100!)
                      (set i=L!i:~-7!)
                      echo rename "%%a" to "!i!"
                      rename "%%a" "!i!"
                      )
                      endlocal

                      T D 2 Replies Last reply
                      0
                      • M megaadam

                        Bingo! :) When I first saw (Windows a.k.a.) Total Commander, I used to sneer at it. But that was a long time ago. Now, I never look at whatsitcalled included with windows.

                        ..................... Life is too shor

                        N Offline
                        N Offline
                        Naruki 0
                        wrote on last edited by
                        #19

                        At least, I think that's what it does, so surely they named it that. Same initials, anyway. Total Commander is da bomb, baby. Select the files (or folders) to rename, press CTRL-M for the rename dialog, and bask in the options. Also note the preview before committing changes.

                        Narf.

                        1 Reply Last reply
                        0
                        • L Larry G Grimes

                          Joe has the best answer on this one.

                          N Offline
                          N Offline
                          Naruki 0
                          wrote on last edited by
                          #20

                          No he doesn't. leppie does. :-)

                          Narf.

                          L 1 Reply Last reply
                          0
                          • D dchuks

                            Use the following script. It does the following: For each *.txt file in the current directory... 1. remove the first character, assuming it is an L 2. add 00 to the front 3. extracts the last 7 characters XXX.txt, where XXX is the original number padded with zeros 4. adds the L back to the front 5. does the rename

                            @echo off
                            setlocal ENABLEDELAYEDEXPANSION
                            for /f "delims=" %%a in ('dir /b *.txt') do (
                            (set i=%%a)
                            (set i=00!i:~1,100!)
                            (set i=L!i:~-7!)
                            echo rename "%%a" to "!i!"
                            rename "%%a" "!i!"
                            )
                            endlocal

                            T Offline
                            T Offline
                            thinicezero
                            wrote on last edited by
                            #21

                            I like that!

                            1 Reply Last reply
                            0
                            • R Russell

                              I have to rename in some folders many file. The file are named like:

                              L1.txt
                              L2.txt
                              ...
                              L9.txt
                              L10.txt
                              ...
                              L99.txt
                              L100.txt
                              ...

                              Now, to apply some code, I need that the names changes to

                              L001.txt
                              ...
                              L009.txt
                              L010.txt
                              ...
                              L099.txt
                              L100.txt

                              I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                              rename L?.txt L00?.txt
                              rename L??.txt L0??.txt

                              but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                              Russell

                              M Offline
                              M Offline
                              Marc Greiner at home
                              wrote on last edited by
                              #22

                              You could try Renamer[^] (free product). For example, I use it to rename my camcorder videos with a filename that equals the video timestamp (YYY-MM-DD HH-MM-SS.MTS)

                              1 Reply Last reply
                              0
                              • M Mike Winiberg

                                Hmm, multiple tools available really, depending on budget and the amount of effort you want to use: ZTREE (remember Xtree for DOS), ZTree is based on this, is still being developed and sold, and has none of the memory limits of the old DOS Xtree, seing as how its a Windows 32bit console app. Otherwise look at XXCOPY if you want something that runs in a window, DirectoryOpus or Powerdesk for native windows GUI. If you want 'free', then Powershell would be a good start, or one of the many 'Norton Commander' clones out there.

                                V Offline
                                V Offline
                                Victor Ulloa
                                wrote on last edited by
                                #23

                                Mike is right, for jobs like these I can't live without ZTree. You can insert, delete portions of the name, insert an autoincrement (with or without the leading zeroes), etc.

                                1 Reply Last reply
                                0
                                • R Russell

                                  I have to rename in some folders many file. The file are named like:

                                  L1.txt
                                  L2.txt
                                  ...
                                  L9.txt
                                  L10.txt
                                  ...
                                  L99.txt
                                  L100.txt
                                  ...

                                  Now, to apply some code, I need that the names changes to

                                  L001.txt
                                  ...
                                  L009.txt
                                  L010.txt
                                  ...
                                  L099.txt
                                  L100.txt

                                  I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                                  rename L?.txt L00?.txt
                                  rename L??.txt L0??.txt

                                  but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                                  Russell

                                  S Offline
                                  S Offline
                                  Simon Capewell
                                  wrote on last edited by
                                  #24

                                  I use either Stexbar[^] or Shell Renamer[^]

                                  1 Reply Last reply
                                  0
                                  • R Russell

                                    I have to rename in some folders many file. The file are named like:

                                    L1.txt
                                    L2.txt
                                    ...
                                    L9.txt
                                    L10.txt
                                    ...
                                    L99.txt
                                    L100.txt
                                    ...

                                    Now, to apply some code, I need that the names changes to

                                    L001.txt
                                    ...
                                    L009.txt
                                    L010.txt
                                    ...
                                    L099.txt
                                    L100.txt

                                    I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                                    rename L?.txt L00?.txt
                                    rename L??.txt L0??.txt

                                    but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                                    Russell

                                    G Offline
                                    G Offline
                                    Gary Wheeler
                                    wrote on last edited by
                                    #25

                                    for /I %I in (1,1,9) do ren L%I.txt L00%I.txt
                                    for /I %I in (10,1,99) do ren L%I.txt L0%I.txt

                                    Software Zen: delete this;

                                    1 Reply Last reply
                                    0
                                    • R Russell

                                      I have to rename in some folders many file. The file are named like:

                                      L1.txt
                                      L2.txt
                                      ...
                                      L9.txt
                                      L10.txt
                                      ...
                                      L99.txt
                                      L100.txt
                                      ...

                                      Now, to apply some code, I need that the names changes to

                                      L001.txt
                                      ...
                                      L009.txt
                                      L010.txt
                                      ...
                                      L099.txt
                                      L100.txt

                                      I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                                      rename L?.txt L00?.txt
                                      rename L??.txt L0??.txt

                                      but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                                      Russell

                                      M Offline
                                      M Offline
                                      MatthewPainter
                                      wrote on last edited by
                                      #26

                                      Up till a couple of months ago I would have written this in VBScript no sweat but these days I am writing everything in PowerShell to get my skills up. Thanks for the challenge.

                                      # Make 100 test files (create dir structure first)
                                      1..100 | % ($_){New-Item "c:\scripts\Lfiles\L$_.txt" -type file}

                                      # Rename all files to specification (remove -whatif switch to make it live)
                                      Get-ChildItem c:\scripts\Lfiles | % ($_){rename-item -path $_.fullname -newname (($_.basename -replace "[0-9]", "")+("{0:000}" -f [int]($_.basename -replace "[^0-9]", ""))+($_.extension)) -whatif}

                                      1 Reply Last reply
                                      0
                                      • H Henry Minute

                                        I think the best way to do this is to use a batch file and the FOR command. Take a look at this[^] for some ideas.

                                        Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

                                        B Offline
                                        B Offline
                                        brimars
                                        wrote on last edited by
                                        #27

                                        Assuming Russell is actually using DOS (we still have machinery running DOS exclusively on 386 and 486 machines), I think Henry's idea is probably the best place to start. The DOS ? and * wildcard characters don't always give exactly the expected results.

                                        1 Reply Last reply
                                        0
                                        • R Russell

                                          I have to rename in some folders many file. The file are named like:

                                          L1.txt
                                          L2.txt
                                          ...
                                          L9.txt
                                          L10.txt
                                          ...
                                          L99.txt
                                          L100.txt
                                          ...

                                          Now, to apply some code, I need that the names changes to

                                          L001.txt
                                          ...
                                          L009.txt
                                          L010.txt
                                          ...
                                          L099.txt
                                          L100.txt

                                          I was thinking to use the old DOS. I was hoping to use a couple of command to solve the problem. Something like

                                          rename L?.txt L00?.txt
                                          rename L??.txt L0??.txt

                                          but it looks to not work as desired. I think it understands the 'input' names, but wrong to interpret the second string of the command. any expert on the 'old' DOS? :)


                                          Russell

                                          T Offline
                                          T Offline
                                          TheF0rmatter
                                          wrote on last edited by
                                          #28

                                          For files with numbers less than 10: FOR /L %F in (1,1,9) DO REN L%F.txt L00%F.txt For files with numbers from 10 to 99: FOR /L %F IN (10,1,99) DO REN L%F.txt L0%F.txt You could expand this out with a check to make sure the file exists: FOR /L %F IN (1,1,9 DO IF EXIST L%F.txt REN L%F.txt L00%F.txt

                                          R I 2 Replies Last reply
                                          0
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • World
                                          • Users
                                          • Groups