DOS question
-
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.txtI 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??.txtbut 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
-
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.txtI 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??.txtbut 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
Wouldn't a quick C# snippet (See snippet compiler[^]) with a regex to rename the text be easier?
If the post was helpful, please vote, eh! Current activities: Playing Star Craft II. Don't bother me, eh? Now and forever, defiant to the end. What is Multiple Sclerosis[^]?
-
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.txtI 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??.txtbut 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
Sounds like a job for...PowerShell!!! Of which I no nothing about, so I can't help you. ;P Marc
-
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.txtI 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??.txtbut 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
No need to go to DOS for this, do it in windows: Select all the files you want to rename, press F2, or right-click on one of the files and select Rename. All of your file selections will disappear except for one, but don't panic: Type in your new name and click Enter. That's it! One file will be now be named "renametext" and the others will have sequential numbers in the format of "renametext (1)" and "renametext (2)" and so on. Not exactly what you are looking for but might work for you.
WJFK (Write Just for Kicks)
-
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.txtI 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??.txtbut 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
Try using a Perl script...or...as previously stated, use C# or VB.Net
-
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.txtI 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??.txtbut 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
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.”
-
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.txtI 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??.txtbut 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
really "DOS" DOS, or Windows command shell? (IIRC, you can do these batch renames in explorer, too)
Agh! Reality! My Archnemesis![^]
| FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy -
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.txtI 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??.txtbut 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
-
+1 for BRU! It works great. :)
There are some really weird people on this planet - MIM.
-
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.txtI 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??.txtbut 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
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 -
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 -
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.txtI 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??.txtbut 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
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
-
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 -
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.txtI 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??.txtbut 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
Flash Renamer - http://www.rlvision.com/downloads.asp[^]
Melting Away www.deals-house.com www.innovative--concepts.com
-
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.txtI 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??.txtbut 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
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
-
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
Joe has the best answer on this one.
-
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.txtI 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??.txtbut 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
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.
-
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.txtI 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??.txtbut 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
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 -
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
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.
-
Joe has the best answer on this one.