PDA

View Full Version : Why change the case?? (WXP-Pro)



thalam
02-28-2006, 01:42 PM
My script below basically finds wherever the archiver.arc file is located and it copies and pastes the entire folder and its contents. The issue I am having right now is that when it pastes it changes it all to lowercase. How can I keep the folder name exactly as the original? Below I have a copy of my script.

dim fso
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Extension = 'arc'")

For Each objFile in colFiles
If objFile.Extension = "arc" Then
If objFile.FileName = "archiver" then
directory = objFile.path 'Gives the full path
driveName=Left(objfile.name,2) 'Gives the name of the drive
objFile.Delete 'Delets the arc file
chrCount = len(directory) 'Counts total number of characters
fromDir = Left(directory,chrCount-1) 'Get's full path without \ at the end
folderStart = InStrRev(fromDir, "\") 'Goes back until it finds \
changeFolder = Left(directory,folderStart) 'From the left, string goes back until first \
folderName=mid(directory,folderStart+1,chrCount-folderStart-1) 'Name of actual folder

'Copies the folders to K:\
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder("c:\script\" & folderName)
FSO.CopyFolder driveName & fromDir, "c:\script\" & folderName

'Changes the archived folder name at the source
Set obj2FSO = CreateObject("Scripting.FileSystemObject")
obj2FSO.MoveFolder driveName & fromDir , driveName & changeFolder & "_Arc_" & folderName
End If
End If
Next
wscript.quit