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 PTC Community Badges. Engage with PTC and see how many you can earn! X

How not to create .m_p .bom .inf files

Matteo_1987
15-Moonstone

How not to create .m_p .bom .inf files

Hello everyone,
Is it possible to prevent the .m_p .bom .inf etc files from being saved on disk?
Matteo.

1 ACCEPTED SOLUTION

Accepted Solutions
KenFarley
21-Topaz I
(To:Chris3)

I wrote a batch file script that traverses a directory structure and does a "purge" of each directory it visits. Since it's doing all that, I eventually added the deletion of these kinds of temporary  work files. I needed something like this because as time has gone on, the number of files on our shared server has geometrically increased, while the size of the files has also increased, and many folks seem to never clean up after themselves when a design is done. The server, though large, is not infinitely so, thus I needed something to reclaim wasted space.

 

Here's the batch file, if anyone is interested. It looks like a lot of gibberish in spots, but that's DOS batch language for you...

 

::
:: Date   * 2020-08-21
:: Author * Kenneth J. Farley
::
:: Recursively traverses the directory structure, starting at the current
:: directory, and executes a purge and any other commands necessary. The
:: pseudocode for this is as follows
::
:: (1) Do a query to get the space available on the current disk.
:: (2) Generate a list of directories
:: (3) For each of the directories
::     a. change to that directory, via a "pushd"
::     b. Execute the desired commands
::     c. change back to the original directory, via "popd"
:: (4) Do a query to get the space available on the current disk.
:: (5) Calculate the space recovered and output the value.
::

@echo off
set drvNow=%cd:~0,2%
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drvNow%'" get FreeSpace /format:value`) do set FreeBefore=%%x
set FreeBefore=%FreeBefore:~0,-6%
for /r /d %%d in ("*") do call :doPurge "%%d"
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drvNow%'" get FreeSpace /format:value`) do set FreeAfter=%%x
set FreeAfter=%FreeAfter:~0,-6%
set /A bytesRecovered=%FreeAfter%-%FreeBefore%
echo.
echo Space Recovered = %bytesRecovered% Mb
echo.
exit /b

::
:: This code is executed for each directory visited. The primary purpose is to
:: run the "purge" command, but it's also helpful to get rid of any other stray
:: files that Pro/E creates in the normal course of operation.
::
:: Note: The "2> nul" construct is used to throw away any "file not found" type
::       errors generated when the delete command doesn't find the target files
::       provided to it.
::

:doPurge
pushd %1
echo Processing %1
call "C:\Program Files\PTC\Creo 4.0\M120\Parametric\bin\purge.bat"

::c:\ptc\purge
::
:: Windows generated files
::
del /ah Thumbs.db 2> nul
::
:: PTC General files
::
del current_session.pro 2> nul
del datafile.ers 2> nul
del errors.lst.* 2> nul
del fix_params.log 2> nul
del *.acc 2> nul
del *.crc 2> nul
del *.err.* 2> nul
del *.idx 2> nul
del *.log.* 2> nul
del std.err 2> nul
del std.out 2> nul
del trail.txt.* 2> nul
del *.xpr 2> nul
del *.tst 2> nul
::
:: PTC Manufacturing files
::
del *.acl 2> nul
del *.lst 2> nul
del *.mbx 2> nul
del *.ncl.* 2> nul
del *.ncl_a.tab 2> nul
del *.ncl_b.tab 2> nul
del *.ncl_c.tab 2> nul
del *.ncl_x.tab 2> nul
del *.ncl_y.tab 2> nul
del *.ncl_z.tab 2> nul
del *.tap 2> nul
popd
exit /b

If you intend to use this kind of thing, you'll need to determine where you particular version of Creo is storing the "purge.bat" file, and change the code accordingly. Be VERY CAREFUL what kinds of files you are deleting - the same file extension might be a data file for another program other than Creo, and you don't want to be deleting things you need.

View solution in original post

4 REPLIES 4

I've never found a way to prevent all these "temporary" garbage files from being created. The worst offender is the manufacturing module - whenever I post-process to g-code I'm stuck with several (maybe ten?) intermediate files that it apparently uses but doesn't clean up. Lazy programming is the only reason I can think of.

For the files I know are always going to be junk, I have a batch file that deletes them - stuff like *.ncl_b.tab files. Every now and then I do a cleanup of all the directories that have been tainted.

JS_9824412
13-Aquamarine
(To:KenFarley)

The only purpose of these junk files could be to prove that some group of PTC designers indeed have done a lot of work. They were/are scared of being ignored or unrecognized. Therefore, every work, good or bad, have been kept: no change allowed!

Chris3
20-Turquoise
(To:Matteo_1987)

We delete them as part of our startup script. I think that's what a lot of companies do.

KenFarley
21-Topaz I
(To:Chris3)

I wrote a batch file script that traverses a directory structure and does a "purge" of each directory it visits. Since it's doing all that, I eventually added the deletion of these kinds of temporary  work files. I needed something like this because as time has gone on, the number of files on our shared server has geometrically increased, while the size of the files has also increased, and many folks seem to never clean up after themselves when a design is done. The server, though large, is not infinitely so, thus I needed something to reclaim wasted space.

 

Here's the batch file, if anyone is interested. It looks like a lot of gibberish in spots, but that's DOS batch language for you...

 

::
:: Date   * 2020-08-21
:: Author * Kenneth J. Farley
::
:: Recursively traverses the directory structure, starting at the current
:: directory, and executes a purge and any other commands necessary. The
:: pseudocode for this is as follows
::
:: (1) Do a query to get the space available on the current disk.
:: (2) Generate a list of directories
:: (3) For each of the directories
::     a. change to that directory, via a "pushd"
::     b. Execute the desired commands
::     c. change back to the original directory, via "popd"
:: (4) Do a query to get the space available on the current disk.
:: (5) Calculate the space recovered and output the value.
::

@echo off
set drvNow=%cd:~0,2%
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drvNow%'" get FreeSpace /format:value`) do set FreeBefore=%%x
set FreeBefore=%FreeBefore:~0,-6%
for /r /d %%d in ("*") do call :doPurge "%%d"
for /f "usebackq delims== tokens=2" %%x in (`wmic logicaldisk where "DeviceID='%drvNow%'" get FreeSpace /format:value`) do set FreeAfter=%%x
set FreeAfter=%FreeAfter:~0,-6%
set /A bytesRecovered=%FreeAfter%-%FreeBefore%
echo.
echo Space Recovered = %bytesRecovered% Mb
echo.
exit /b

::
:: This code is executed for each directory visited. The primary purpose is to
:: run the "purge" command, but it's also helpful to get rid of any other stray
:: files that Pro/E creates in the normal course of operation.
::
:: Note: The "2> nul" construct is used to throw away any "file not found" type
::       errors generated when the delete command doesn't find the target files
::       provided to it.
::

:doPurge
pushd %1
echo Processing %1
call "C:\Program Files\PTC\Creo 4.0\M120\Parametric\bin\purge.bat"

::c:\ptc\purge
::
:: Windows generated files
::
del /ah Thumbs.db 2> nul
::
:: PTC General files
::
del current_session.pro 2> nul
del datafile.ers 2> nul
del errors.lst.* 2> nul
del fix_params.log 2> nul
del *.acc 2> nul
del *.crc 2> nul
del *.err.* 2> nul
del *.idx 2> nul
del *.log.* 2> nul
del std.err 2> nul
del std.out 2> nul
del trail.txt.* 2> nul
del *.xpr 2> nul
del *.tst 2> nul
::
:: PTC Manufacturing files
::
del *.acl 2> nul
del *.lst 2> nul
del *.mbx 2> nul
del *.ncl.* 2> nul
del *.ncl_a.tab 2> nul
del *.ncl_b.tab 2> nul
del *.ncl_c.tab 2> nul
del *.ncl_x.tab 2> nul
del *.ncl_y.tab 2> nul
del *.ncl_z.tab 2> nul
del *.tap 2> nul
popd
exit /b

If you intend to use this kind of thing, you'll need to determine where you particular version of Creo is storing the "purge.bat" file, and change the code accordingly. Be VERY CAREFUL what kinds of files you are deleting - the same file extension might be a data file for another program other than Creo, and you don't want to be deleting things you need.

Announcements