Hi,
I am working on a project that was imported from Framemaker. The filenames of the .htm files are not in a standard format, so I want to rename and update all links related to that file.
I can use the Rename file and then Update all links, but doing this manually for tens of thousands of files sounds like very time consuming.
Is there anyway to automate this process by writing a program to Rename-file + get related files(using the "Linked from" list in Link Viewer) and update with new file name.
Does Madcap Flare provide APIs that will get the list of Linked-froms for given file? Or an API that does the whole renaming process and updating links on per-file basis?
Please help me with this.
Thanks.
Renaming thousands of files at once.
-
- Propellus Maximus
- Posts: 1238
- Joined: Mon Feb 27, 2006 5:56 am
- Location: Melbourne, Australia
Re: Renaming thousands of files at once.
I've used an external tool called FAR to do this sort of thing. Not free but is very useful and very reasonable price.
Have a look at: http://www.helpwaregroup.com/products/far
Have a look at: http://www.helpwaregroup.com/products/far
Margaret Hassall - Melbourne
-
- Propellus Maximus
- Posts: 810
- Joined: Wed Jul 25, 2012 11:36 am
- Location: Ann Arbor, MI
Re: Renaming thousands of files at once.
The best I can offer is a two-step process (and please make a backup of the folder first):
First, copy the following code to a NotePad file and save it with a .vbs extension. Be sure to change C:\Users\kwag.myers\Documents\Test to the correct directory. This script creates a log of all files having spaces in the name and changes the space to an underscore.
Then, using the FileList.txt, use my search and replace script here to update all links.
First, copy the following code to a NotePad file and save it with a .vbs extension. Be sure to change C:\Users\kwag.myers\Documents\Test to the correct directory. This script creates a log of all files having spaces in the name and changes the space to an underscore.
Code: Select all
Dim sName
Dim fso
Dim fol
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
' get current folder
Set fol = fso.GetFolder("C:\Users\kwag.myers\Documents\Test")
' log files with spaces
Set NewFile = fso.CreateTextFile(fol&"\FileList.txt", True)
' go thru each file in the folder
For Each fil In fol.Files
' check if the file name contains spaces
If InStr(1, fil.Name, " ") <> 0 Then
' log the file name
NewFile.WriteLine(fil.Name)
' replace with underscore
sName = Replace(fil.Name, " ", "_")
' rename the file
fil.Name = sName
End If
Next
WScript.Echo "Completed!"
"I'm tryin' to think, but nothin' happens!" - Curly Joe Howard