Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ilogic to rename multiple step files without opening each model

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
bengee5454
1048 Views, 5 Replies

ilogic to rename multiple step files without opening each model

I used task scheduler to convert mutiple ipt file to step files.

 

Unfortunately the files are now all called filename.ipt.step

 

can I rename each file to remove the '.ipt' so that the files are called filename.step? Perhaps using ilogic? or is there an easier way?

 

I could of course just go to Windows Explorer and manually rename each one, but that will be tedius beyond belief!

 

h, can someone please tell me the difference (if any) between step, stp, ste

5 REPLIES 5
Message 2 of 6
PaulMunford
in reply to: bengee5454

There is a free application out there called renamed that might help you.

 


Autodesk Marketing Manager D&M
Opinions are my own and may not reflect those of my company.
Linkedin Twitter Instagram Facebook Pinterest

Message 3 of 6
hossaiy
in reply to: bengee5454

Hi Ben,

 

Here is a video showing how to do that just using Windows command prompt:

 

 

 

It might not be immediately obvious from the video, but to open a command prompt from within a specific directory, hold down shift and right click in the desired directory. Then just click "Open command window here".


Hope it helps.


Thanks
 

 



Yacoub Hossain
Message 4 of 6
bengee5454
in reply to: PaulMunford

Thanks, I've had a look and i can see Bulkrenamer, Renamer.....guess any of them will do.

 

Thanks for pointing me in the right direction.

Message 5 of 6
bengee5454
in reply to: hossaiy

thanks, will try that tomorrow

Message 6 of 6

Hi ben.gee,

You can try this iLogic code. I use it for stripping out the file extensions after using the task scheduler.

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

 

 

Imports System.IO
Imports System.Windows.Forms

Sub Main
	Call FileType()
	Call StripText()
	Call GetFolderPath()
	Call RenameFiles()
	
	Try
		'open the folder 
		Process.Start(oPath)
	Catch
	End Try
	
End Sub

'[ shared variables
Dim oPath As String
Dim oFileExtension As String
Dim oStripText As String 
']

Sub FileType()
Dim oFileTypes = New String(){".stp", ".step" ,".igs" ,".iges" ,".sat"}
oFileExtension = InputListBox("Select one:", oFileTypes, oFileTypes(0), _
"iLogic", "Select a file type:")
End Sub

Sub StripText()
Dim sStripText = New String(){".ipt", ".iam" ,".ipn" ,".idw" ,".dwg"}
oStripText = InputListBox("Select one:", sStripText, sStripText(0), _
"iLogic", "Select text to remove:")
End Sub

Sub GetFolderPath()
	'check for existing path
	If SharedVariable.Exists("oFolderName") = True Then
		'get uer input
		oReuse = MessageBox.Show("Do you want to use this folder again:" & _
		vbLf & SharedVariable("oFolderName"), "iLogic",MessageBoxButtons.YesNo)
	End If
	
	If oReuse = vbYes Then
		'set path to the folder used prviously
		oPath = SharedVariable("oFolderName")
	Else
		'let user choose folder
		Dim dialog = New FolderBrowserDialog()
		' dialog.SelectedPath = Application.StartupPath
		dialog.ShowNewFolderButton = True
		' openFileDialog1.InitialDirectory 
		If DialogResult.OK = dialog.ShowDialog() Then
			oPath = dialog.SelectedPath
			SharedVariable("oFolderName") = oPath
		Else
			MessageBox.Show("No Folder Selected.", "iLogic")
			Return 
		End If
	End If
End Sub
		
Sub RenameFiles()
	'check for empty path 
	If oPath = "" Then 
		Return 'exit rule
	Else
		'give the user a chance to back out
		RUSure = MessageBox.Show("Are you sure you want to remove " & _
		oStripText & " from all of the " & oFileExtension & " files?", _
		"iLogic",MessageBoxButtons.YesNo)
		
		If RUSure = vbNo Then
		Return 'exit rule
			Else
		End If
	End If

'loop through foldr looking for step files
For Each oFile As String In Directory.GetFiles _
	(oPath, "*" & oFileExtension ,IO.SearchOption.AllDirectories)
	'convert file name to string
    Dim sName As String = oFile
	If sName.Contains(oStripText) Then
		'get length of file name
		Dim iLen As Integer = Len(sName)
		'set new name by discarding the last # characters of the file name
		'where # of characters is length of oFileExtension & oStripText
		Dim oNewName As String
		oNewName = Left(sName, iLen - Len(oFileExtension) - Len(oStripText) )
		'check for exsiting file with the new name
		If File.Exists(oNewName & oFileExtension) Then
			'inform user And skip file
			MessageBox.Show("A file named " & oNewName & oFileExtension & _
			" already exists." & vbLf & sName & " will not be renamed.", "iLogic")
			Continue For'skips rename
		Else
			'rename the file
			File.Move(Path.Combine(oPath, oFile), Path.Combine _
			(oPath, oNewName & oFileExtension))
		End If
	End If
Next
End Sub

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report