cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

Python convertion .xmcd to .mcdx of multiple files in nested folders using API for builtin converter

NK_10848499
3-Visitor

Python convertion .xmcd to .mcdx of multiple files in nested folders using API for builtin converter

I have enormous number of .xmcd files needed to be converted to .mcdx. Inside most of them there are links to each other. Considering nested structure of my files and the fact that you can not choose the whole folder for nested convertion in built-in MathCAD Prime Converter I need to automate at least filling Converter with list of files. Would be even better - to make the whole process fully automatic. Have someone done this before? Is there any API for the Converter? Nothing like that was found by me in the PTC support database 😞

There is some kind of workaround - to generate multiple paths to files relative to the root folder and join them with " "`s but resulting string is far too long to be accepted by the FilePickupDialog of the Converter. Too many files needed to be converted.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi,

You must use the power of windows to select all the files in all the directory tree structure.

the converter will place the new files in the correct directories..

For example a three tiered directory structure.

Capture.JPG

With one Mathcad 15 etc file per directory.  This works no matter how many files in a directory

Capture2.JPG

Capture3.JPG

Capture4.jpg

Note one file is *.mcd other two are *.xmcd.

Start the converter from Prime or as stand alone and press add worksheets

Capture6.JPG

You get the windows open dialog box.  In the upper right hand search box type *.*mcd as the search term and it will select files in the directory structure for you.  Ctrl A will select them all.

Capture7.JPG

Choose open and the list box in the converter is filled with the relevant files with their directory included.

Capture8.JPG

Select  them all with CTRL A.  Press convert and leave it alone until finished.

Capture9.JPG

Now check the directories:  Each directory has the converted file and a html log of the conversion..

Capture10.JPG

Capture11.JPG

As far as I am aware there is no limit to the number of files in the directory tree.

 

Cheers

Terry

View solution in original post

4 REPLIES 4

Hi,

Converter can take large number files.  There are 233 files here loaded in one go from a directory

Capture.JPG

Press Ctrl  A to select all the files then you can convert them in one go:

Capture2.JPG

Hi,  terryhendicott !

Thanks for answering, but all those files on your screens are in the same directory "F:\MathCad\", aren`t they? In my case I have hundreds of deep-nested folders and thousands of files. Furthermore, that folder structure should be intact due to the fact that most of of the files have each other inserted as a reference with fixed relative paths.
 
 

Hi,

You must use the power of windows to select all the files in all the directory tree structure.

the converter will place the new files in the correct directories..

For example a three tiered directory structure.

Capture.JPG

With one Mathcad 15 etc file per directory.  This works no matter how many files in a directory

Capture2.JPG

Capture3.JPG

Capture4.jpg

Note one file is *.mcd other two are *.xmcd.

Start the converter from Prime or as stand alone and press add worksheets

Capture6.JPG

You get the windows open dialog box.  In the upper right hand search box type *.*mcd as the search term and it will select files in the directory structure for you.  Ctrl A will select them all.

Capture7.JPG

Choose open and the list box in the converter is filled with the relevant files with their directory included.

Capture8.JPG

Select  them all with CTRL A.  Press convert and leave it alone until finished.

Capture9.JPG

Now check the directories:  Each directory has the converted file and a html log of the conversion..

Capture10.JPG

Capture11.JPG

As far as I am aware there is no limit to the number of files in the directory tree.

 

Cheers

Terry

The key is <*.*mcd>! That was so easy, thanks a lot 🙂

Top Tags