Renaming Procedure
Renaming Procedure
(OP)
Is it possible to rename model and drawing files such as ABCD.sldprt & ABCD.slddrw to Abcd.sldprt & Abcd.slddrw? Basically, retain the original filenames but change from upper to lower case. I have many files on which I must make this conversion & so far, everything I've tried has been unsuccessful.
Thanks for any suggestions
Thanks for any suggestions






RE: Renaming Procedure
You have many files to change so you really need a macro to do this. The above method is a real PITA for more than a few files. Hopefully someone here can help with that. If not, try asking the question on a suitable forum in Tek-Tips.
Helpful SW websites FAQ559-520
How to get answers to your SW questions FAQ559-1091
RE: Renaming Procedure
Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
RE: Renaming Procedure
RE: Renaming Procedure
If you just want to rename your files from ABCD.sldprt & ABCD.slddrw to Abcd.sldprt & Abcd.slddrw, you do not need to go through SolidWorks or SolidWorks Explorer. You can just rename them using Windows Explorer. No SolidWorks drawing or assembly model documents will complain the case changes of your part names.
Alex
RE: Renaming Procedure
Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
RE: Renaming Procedure
That's generally true if you rename files. But if you just want to change file name from upper case to lower case or vice versa as 4x4cadguy would like to do, it is safe to rename them in Win Ex. No links will be lost.
Alex
RE: Renaming Procedure
The files are all located in a common directory, but I'm not up on my VB so automation will have to wait.
Thanks again.
RE: Renaming Procedure
Chris
Systems Analyst, I.S.
SolidWorks/PDMWorks 05
AutoCAD 06
ctopher's home site (updated 06-21-05)
FAQ559-1100
FAQ559-716
RE: Renaming Procedure
RE: Renaming Procedure
To use the code below, paste it into a blank text file and then rename with .vbs extension instead of .txt. Double click to execute and type/paste a path into the input box.
-Josh
CODE
sub main()
dim wshShell
dim sUserName
dim oFSO
dim myFolder
dim AllFiles
dim File
dim i
dim FileName
dim RenamePath
dim FileNameAndPath
Set wshShell = WScript.CreateObject("WScript.Shell")
sUserName = wshShell.ExpandEnvironmentStrings("%USERNAME%")
Set oFSO = CreateObject("Scripting.FileSystemObject")
RenamePath = inputbox("Enter the path to rename files to lower case")
If Not oFSO.FolderExists(RenamePath) Then
msgbox "Folder " & RenamePath & " does not exist!"
exit sub
end if
set MyFolder = oFSO.GetFolder(RenamePath)
set AllFiles = myFolder.Files
i = 0
for each File in AllFiles
FileNameAndPath = left(file.path, len(file.path)-len(file.name)) & _
ucase(left(file.name,1)) & lcase(right(file.name, len(file.name)-1))
file.move FileNameAndPath & "x"
file.move FileNameAndPath
next
end sub