Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » Bat File to save file names
Closed Thread
Old 10-17-2005, 10:45 PM   #1 (permalink)
 
Newb Techie

Join Date: Oct 2005

Posts: 1

cjp12711

Default Bat File to save file names

Hello! I'm trying to write an automated script, and this one has be stumped!

I have 2 files. 1 is named 12345.txt and 1 is named 1_file.zip. I want to have some kind of automation to rename 12345.txt to 1file.txt. I want to grab the info from the 2nd file before the extension to be able to rename the first. The exception is that the underscore needs to be removed as well for the first file. This is always the 3rd character in the file name. The extensions need to stay as is. Hopefully this makes sense!

This is what I start with:

12345.txt
1_file.zip

This is what I want:
1file.txt
1_file.zip

Does anyone know how to accomplish this? This is a manual task we have to do every day, and is prone to human mistakes...
Thanks for any help!
cjp12711 is offline  
Old 10-18-2005, 02:36 AM   #2 (permalink)
 
Monster Techie

Join Date: May 2004

Location: /usr/root/mn/us

Posts: 1,121

bla!! is on a distinguished road

Default

This isn't something that you can do with a batch file.

You need to be able to manipulate strings to re-assign the name and remove the _.

I'd look into a VB Script or some other scripting language.
__________________
<br>
Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On