| Author |
Message |
| HyToFry |
Posted: Fri Sep 05, 2003 7:22 pm Post subject: 1 |
|
Yup, but then you have to write a bat file... which is just as easy as what was already done... I think. 
Too late now anyway. |
|
 |
| extropalopakettle |
Posted: Fri Sep 05, 2003 6:58 pm Post subject: 0 |
|
| Can't you have the for loop call a bat file, and have that do the two commands? |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 6:14 pm Post subject: -1 |
|
It's a damn shame that FOR can't handle two commands....
| Code: |
| for %i in (*.*) DO set tempfile=%i|rename %i %tempfile:~4,99% |
In theory, that would work... but it doesn't because for can't handle the multiple commands. |
|
 |
| Logain |
Posted: Fri Sep 05, 2003 6:09 pm Post subject: -2 |
|
| Sorry Vinny, just noticed your post after already replying. I had just tested Hy's method so I already know what I'm doing there and it worked just fine. |
|
 |
| Logain |
Posted: Fri Sep 05, 2003 6:08 pm Post subject: -3 |
|
Hey Hy, that seems like it will work great. 
I'll have to first cut and paste the results in an Excel spreadsheet since the yyyy is different for each file, so deleting a column is easier there than a search/replace, then paste back into the .bat file. Thanks for the tip. |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 5:59 pm Post subject: -4 |
|
my way is still easier.  |
|
 |
| Vinny |
Posted: Fri Sep 05, 2003 5:57 pm Post subject: -5 |
|
Do what MBA said, Logain. Use ASP if you have either Windows 2000 or Windows XP and have the component "Internet Information Servicess (IIS)" installed.
If you do, just go to c:\inetpub\wwwroot\ and create a text file using notepad, with the extension .asp.
Let's name it test.asp for illustration purpose.
Open the text file, then copy and paste the following code into the file, and save.
code:
<% Option Explicit
Dim filesys, demofolder, fil, filecoll, filist Set filesys = CreateObject("Scripting.FileSystemObject") Set demofolder = filesys.GetFolder("c:\temp\") Set filecoll = demofolder.Files For Each fil in filecoll filist = filist & fil.name filist = filist & "<BR>" Next
Response.Write filist %>
To run it, open a web browser, the go the url http://localhost/test.asp
Tell me if that works. If it does, it should list all the content of a c:\temp\ folder (if the folder exists). You can then modify the code to do all sort of neat stuff, like mass renaming.
Use http://www.devguru.com (Quick References -> VBScript) for reference. For more things you can do with the FileSystemObject, look at the Objects section of that site.
http://www.devguru.com/Technologies/vbscript/quickref/filesystemobject.html
|
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 4:48 pm Post subject: -6 |
|
Or.. even better.
| Code: |
| FOR %i in (*.*) DO echo rename %i ~%i >> rename.bat |
Then just search/replace ~yyyy with nothing.
------------------ Whatever poison's in this bottle, will leave me broken sore and stiff... but it's the genie at the bottom, who I'm sucking at; he owes me one last wish.
[This message has been edited by HyToFry (edited 09-05-2003 12:50 PM).] |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 4:21 pm Post subject: -7 |
|
Just make sure that you include the extension in that search and replace bit. Otherwise you'll end up with a batch file that renames yyyy.ext to yyyy.ext.  |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 4:19 pm Post subject: -8 |
|
here's something you could do.
| Code: |
| FOR %i in (*.*) DO echo rename %i %i >> rename.bat |
Now open that up in a text editor capable of replacing strings.
If the files are named *.html, then do this: Find ".html xxxx" and replace with ".html "
Now save it, and run the batch file.
|
|
 |
| mole |
Posted: Fri Sep 05, 2003 4:14 pm Post subject: -9 |
|
| Is there a shell command in BASIC to do the same thing as Chuck's idea? There's no reason to build a batch file and run that if you can run commands directly from BASIC. |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 4:11 pm Post subject: -10 |
|
Never mind this post. I was in the wrong thread or something. 
[This message has been edited by HyToFry (edited 09-05-2003 12:16 PM).] |
|
 |
| MBA |
Posted: Fri Sep 05, 2003 3:33 pm Post subject: -11 |
|
| You can do it via an asp page on an IIS web server. Just use the FileSystemObject (read more about FSO at [url=http://www.aspfaqs.com).]http://www.aspfaqs.com).[/url] Read the filename into a variable and then use the LEFT, RIGHT and MID functions to rename the file as you desire. |
|
 |
| HyToFry |
|
 |
| Chuck |
Posted: Fri Sep 05, 2003 2:41 pm Post subject: -13 |
|
| I'd write a short BASIC program the made a large batch file that renamed them one by one if I couldn't figure out how to do it with a DOS command. |
|
 |
| HyToFry |
Posted: Fri Sep 05, 2003 1:30 pm Post subject: -14 |
|
| I'll look at it when I get to work. It is possilble. |
|
 |
| Antrax |
Posted: Fri Sep 05, 2003 1:02 pm Post subject: -15 |
|
Okay, I feel really stupid. There is a way to do it with DOS for command, but I just can't figure it out. What's worse, I get the exact same problem every time I have to do a mass rename or something of the sort, I solve it every time, but I never seem to remember how I did it last time. Just type "help for" and "help set" at DOS prompt, you can probably figure it out. I'm too tired, apparently ~annoyed at self~ Antrax
------------------ "Look, that's why there's rules, understand? So that you think before you break 'em" - Lu-Tze, Thief of Time
|
|
 |
| Death Mage |
Posted: Fri Sep 05, 2003 12:35 pm Post subject: -16 |
|
| Last time I had to do something like that, I basically had to use a program that made a macro, a series of keystrokes, and repeated it over and over and over. And even then, I could only do it in small blocks. :\ It's not fun to do. |
|
 |
| Logain |
Posted: Fri Sep 05, 2003 12:24 pm Post subject: -17 |
|
OK, I have small problem with renaming files. I have about 6000 files I need to rename and I would hope there's some utility out there (since I can't figure out how to do it with DOS wildcards) to make this easier.
The files are all named in the following format:
xxxxyyyyyy.zzz
where the number of ys changes from file to file. I simply want to remove the first four characters of each file (represented by the xs).
Anyone know an easy way? |
|
 |