Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
Ren multiple files in DOS
Name: mac99 Date: June 3, 2009 at 04:23:56 Pacific OS: Windows XP CPU/Ram: 1GB Product: Dell / GX280 Subcategory: Batch
Comment:
Any help would be appreciated. I need to rename multiple files in a folder (to insert 4set characters at the beginning of the filename and move the numbers to the end of the file name) where the filename is typically an address (ie 27,Mystreet.doc) to read ABC_Mystreet,27.doc preferably via a DOS batch file? Any ideas?Thanks
Name: ghostdog Date: June 3, 2009 at 19:23:59 Pacific
Reply:
is ABC a constant? show real life examples of your file naming conventions and show more examples of your renamed file names.
0
Response Number 2
Name: mac99 Date: June 3, 2009 at 23:46:44 Pacific
Reply:
Thanks for responding.Yes, ABC is a constant(actually its ASB_ ). The files are normally .doc or .pdf and the convention is nn streetname (ie 02 thomas street or 5 acorn road) - in a number of cases the filename also has COMPLETE as the final part of the filename ( 02 thomas street COMPLETE). The renamed file should read ASB_thomas street,02 or ASB_acorn road,2 (the COMPLETE is to be deleted in all cases) Thanks again.
0
Response Number 3
Name: ghostdog Date: June 4, 2009 at 00:09:39 Pacific
Reply:
if you have Python on Windows
import os
path=os.path.join("c:\\","test")
os.chdir(path)
for files in os.listdir(path):
ext = files[-4:]
name=files[:-4]
if ext == ".doc" or ext == ".pdf":
files=files.replace("COMPLETE","")
number,street = name.split(" ",1)
newfilename = "ASB_"+street+","+number+ext
os.rename(files,newfilename)
Name: mac99 Date: June 4, 2009 at 02:54:42 Pacific
Reply:
Sorry but i don't have Python (& our techies have locked down the pc's for software downloads!) Is there an alternative solution using MSDOS Command prompt (WinXP)? (the python script does look the biz tho!)
Summary: Hi, I have been asked to make a TSR in C/DOS which can open and DISPLAY a TIFF image file. Can any one help in how I go about, basically displaying the TIFF file in DOS?????? ...
Summary: I am trying to write a batch file in DOS which will do the following: Step 1: Copy some files(like for example a.txt, b.txt, c.txt) from a disk location C:/ Step 2: Put the above copied files to a dis...
Summary: I need to rename a file in a DOS Batch script but do not know how to handle the long file name. Filename: eop.test_BBB_2005052000000M07S.txt I want to rename the file to Filename: 2005052000000M07S.tx...