×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Renaming Procedure
4

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

RE: Renaming Procedure

When doing the change manually, one method is to change ABCD.sldprt to AbcdX.sldprt first & then change again to remove the X. The X can be anything you want. This is a Windows "problem" & Windows does not appear to recognise a difference between upper & lower case so it has to be tricked/forced to.

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.

cheers
Helpful SW websites  FAQ559-520
How to get answers to your SW questions  FAQ559-1091

RE: Renaming Procedure

I suggest using solidworks explorer. You can rename, copy or move much cleaner and safer.

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

Where are all these files located?  Are they all in a single directory or sort of random?  It would be fairly easy to write a vbscript to automate the AbcdX method above as long as you can tell the script what/where to look.  Google for FSO or FileSystemObject for samples, etc.  It will be the main workhorse of the script you need.  If you get stuck I may be able to help as I've done this sort of thing several times.

RE: Renaming Procedure

Hi, 4x4cadguy:

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

The problem with renaming in Win Ex is you can lose the links. You will have to search for the parts when opening the assy or dwg. Don't have to with SW Ex.

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

Hi, Chris and 4x4cadguy:

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

(OP)
Thanks to all for the tips. I originally tried SW Explorer but that didn't work as I was creating "a circular reference"--SW would not allow the same file name. Apparently SW is not case sensitive. SW Explorer does work well if the name actually changes i.e. Abcd > Efgh. I've been using the AbcdX method, sort of. I'm renaming the files by doing a "file/save as" from the drawing and changing the part reference to the new name. I then delete the original file in Win Explorer and go back to SW to do a "file/save as" with the X deleted. It's cumbersome to say the least but it's working fairly well. The only problem I've seen so far is that sometimes the Feature Mgr & assy BOM's do not update to reflect the case change.
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

If you use PDMWorks, you can rename as often as you like.

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

Win explorer does not recognize case, so you cannot rename a file directly from "ABCD.SLDPRT" to "Abcd.sldprt" from any application in Windows, PDMWorks, SW explorer or Solidworks.  Windows cannot tell the difference.  You have to change the filename to something else first, which is why it's best to use SW explorer or Solidworks so as not to lose the links.

RE: Renaming Procedure

Here is a VBScript program for renaming all files in a directory to lower case.  It renames each [FILeNaME].[ExT] to [Filename].[ext]x and then to [Filename].[ext].  I renamed one folder of a machine's parts/subassemblies and then opened the main assembly by double-clicking the assembly file in Win Explorer.  SW found all the parts/subassemblies with no problem.  However, all of the temporary files that were created were in the same case as the original file prior to renaming.  Also, a find references from SW found all of the files, but the names shown there were also in the original case.  In other words, SW was totally oblivious to the change of case.  This is consistent with the entire Windows system being case-insensitive.  If you want SW to know that the case has been changed you will have to rename with SW Explorer or SW itself.

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

call main

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources