|
-
July 30th, 2002, 10:47 AM
#1
Rename a file extension to the file name in a batch file
Hello all:
In a batch file is there a way a person could take a file, rename the file name to its extension and then change the extension to something else? Then, following this pattern, have the changes applied to a large amount of files all at the same time?
ex: .123 changed to 123.txt
.987 changed to 987.txt
.654 changed to 654.txt
.345 changed to 345.txt
.678 changed to 678.txt
Thanks in advance
Andrew
-
July 30th, 2002, 05:02 PM
#2
It would be simple if all the files had extensions .123 but you are saying there are several combinations of numbers. I don't know of any way to do that even in DOS. Not using the example you descibe at least. In DOS a simple ren command could change all .123 files to .txt
It would look like this: C:> ren *.123 *.txt
So your proposed batch file would be a list of that rename command for every file extension.
tiberiuscan
-
July 30th, 2002, 05:47 PM
#3
I can get you almost there.
ren *.* *.*.txt
that will give you a three part file name and I think change the file type with all being txt files but I do not know how to strip off the first part of the file name.
I just tried this and it seemed to work.
-
August 2nd, 2002, 07:10 AM
#4
What version of Windows/DOS does the batch file need to run under? There are ways of doing this with batch files, but there are also much easier methods of programming this function available. If I wanted to do this, I'd use either a QBasic program or a Visual Basic program to do it.
-
August 2nd, 2002, 09:12 AM
#5
Hey thanks for replying.
The ren *.* *.*.txt helped point me in the right direction.
I'm planing to run the batch under a win2k pro enviroment.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|