Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows 2000 Batch File 3

Status
Not open for further replies.

edemiere

MIS
May 13, 2003
483
US
Hello everyone. I am a very experienced computer user, however I have a problem now that I have never had to tackle.

I have a bunch of files in a directory like this:

xyz0101a.dwg

I need to convert the files to all uppercase. I have easily made the files look like this:

XYZ0101a.dwg

The last letter before the .dwg is causing me grief (as it can be any letter in the alphabet).

Is anyone an advanced batch script writer that can help me create the necessary batch file to convert all letters to uppercase in a filename?

Thanks in advance for any insight anyone can provide.

Cheers!

 
AirCon

Ok, I made the pathing changes as necessary in the script like I did the original one, however, no matter what I try I get the following error:

Script: G:\CMH_NS Groups\DWGS\AKRN\backup.js
Line: 63
Char: 4
Error: 'undefined' is null or not an object
Code: 800A138F
Source: Microsoft JScript runtime error

The only changes I made are:

cSrcDrive = "G:\\CMH_NS Groups\\DWGS\\AKRN\\"
cDestDrive = "E:\\ZTEMP\\AKRN\\"

And I also tried:

cSrcDrive = "G:\\CMH_NS Groups\\DWGS\\AKRN"
cDestDrive = "E:\\ZTEMP\\AKRN"

But still come out with the same error.

Cheers!

 
Ahh..yes. Sorry I missed one line,

at (almost) the beginning of the script, change this line:

if (oFolders.Files.Count > 0)
CopyFilename(oFolders)

with this:

if (oFolders.Files.Count > 0)
CopyFilename(oFolders, cDestDrive)


It should work now

-- AirCon --
 
AirCon

Now it's saying:

Line: 70
Char: 7
Error: Path not found
Code: 800A004C
Source: MS Jscript runtime error

Thanks!

 
Is this folder "E:\\ZTEMP\\AKRN" exist? As I mentioned the first target folder must exist.

Try again :)

-- AirCon --
 

Yeah, it exists and has existed since we started this little endeavor. [bigsmile]

Cheers!

 

It gets as far as creating the 001 directory under the AKRN directory and thats where it stops...

Cheers!

 

Ok, I turned on your dialogue to have it show me what it's doing and here is what the prompt says:

D:\ZTEMP\AKRN\\ -> copy to -> E:\ZTEMP\AKRN\
I put test files to use in:

D:\AKRN

and I am copying to:

E:\ZTEMP\AKRN

The paths at the top of the script say:

cSrcDrive = "D:\\AKRN"
cDestDrive = "E:\\ZTEMP\\AKRN"

I see what the problem is, but can't trace where its picking up the D:\ZTEMP as it doesn't exist and there is no reference to that in the script.

Hope that helps you solve it.

Thanks! [2thumbsup]

 

Ok, I moved my test files into D:\ZTEMP and it works for a bit until it blows up, however, I picked up something strange.

It copies all the files it should except in the AMS directory. The AMS directory has:

AMS0101A.dwg
AMS03.dwg
AMS04.dwg
AMS0401A.dwg
AMS0401B.dwg
AMS0401C.dwg
AMS0401D.dwg
AMS0401E.dwg
AMS0401F.dwg
AMS0401G.dwg
AMS0401H.dwg
AMS0401I.dwg
AMS0401J.dwg
AMS0501A.dwg
AMS0501B.dwg
AMS0501C.dwg
AMS0501D.dwg
AMS0501E.dwg
AMS0501G.dwg
AMS0501H.dwg
AMS0501I.dwg
AMS0501J.dwg
AMS0501K.dwg
Drawing.dwg

And what it copies is:

AMS0101A.dwg
AMS0501K.dwg
Drawing.dwg

It seems to completely ignore the AMS03xxX and AMS04xxX series, must have something to do with those bogus filenames that appear and unfortunately for me I cannot guarantee what these directories contain. :-( Perhaps we can rigidly look at the 8.3 format and maybe even limit it down to .dwg files only (since they are all I am really after anyhow).

Just a thougth, but let's get the pathing on the script done first and we can proceed from there. [dazed]

Cheers!

 
Edemiere,

Ok, I see that. You must make target folder exactly the same with the source folder. Otherwise I had to write much more script. So I think it would be no problem for you if you make it the same. Or is it a problem?

About the filename, you must have a pattern first. I can't figure out how without it.

Also, if you want to learn more about JScript, you can go to Script forum here:
forum216

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top