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

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

How can you delete all files before .prt.X the latest version

DenisJaunin
15-Moonstone

How can you delete all files before .prt.X the latest version

Hello,

How can you delete all files before .prt.X the latest version or even before the latest version as well as other unnecessary files on all hard disk.

Obviously, a backup of the hard disk was made before.

In time there was a program that spanked this very well: "Spekpur"

Is there now a single program that can do this in one go.

Best regards.

Denis.

1 ACCEPTED SOLUTION

Accepted Solutions

I don't know of any program that can be run from within Creo to do this, but I have a DOS batch file that does. It uses the program that is supplied with Creo, called "purge.exe". For me, it's located in "C:\Program Files\PTC\Creo 2.0\Common Files\M160\x86e_win64\obj".

The batch file I made traverses the directory structure and "purges" each directory, which deletes all earlier versions of the file types associated with Creo, like *.asm.*, *.prt.*, etc. I've also, as you'll see, added other deletions, like getting rid of .m_p files and other temporary files Creo seems to like to create. Since .bat files can't be downloaded by a lot of users, here is the text of the file:

--- [ Begin recpurge.bat ] ---

::

:: Date   * 30 August 2015

:: 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) Generate a list of directories

:: (2) 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"

::

@echo off

for /r /d %%d in ("*") do call :doPurge "%%d"

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

c:\ptc\purge

::

:: Windows generated files

::

del /ah Thumbs.db 2> nul

::

:: PTC General files

::

del APS00W07 2> nul

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 *.inf.* 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

--- [ End recpurge.bat ] ---

Modify the program to look in the proper directory for the "purge.exe", add or delete other files to "clean up", etc.

As usual, I'm not responsible for any troubles you encounter in using this technique. As with any such utility, you will want to test it out on a small directory first before unleashing it on a large directory structure.

Also, I always run this in a "Command Prompt" window, don't know if it works well any other way.

View solution in original post

11 REPLIES 11

I don't know of any program that can be run from within Creo to do this, but I have a DOS batch file that does. It uses the program that is supplied with Creo, called "purge.exe". For me, it's located in "C:\Program Files\PTC\Creo 2.0\Common Files\M160\x86e_win64\obj".

The batch file I made traverses the directory structure and "purges" each directory, which deletes all earlier versions of the file types associated with Creo, like *.asm.*, *.prt.*, etc. I've also, as you'll see, added other deletions, like getting rid of .m_p files and other temporary files Creo seems to like to create. Since .bat files can't be downloaded by a lot of users, here is the text of the file:

--- [ Begin recpurge.bat ] ---

::

:: Date   * 30 August 2015

:: 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) Generate a list of directories

:: (2) 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"

::

@echo off

for /r /d %%d in ("*") do call :doPurge "%%d"

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

c:\ptc\purge

::

:: Windows generated files

::

del /ah Thumbs.db 2> nul

::

:: PTC General files

::

del APS00W07 2> nul

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 *.inf.* 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

--- [ End recpurge.bat ] ---

Modify the program to look in the proper directory for the "purge.exe", add or delete other files to "clean up", etc.

As usual, I'm not responsible for any troubles you encounter in using this technique. As with any such utility, you will want to test it out on a small directory first before unleashing it on a large directory structure.

Also, I always run this in a "Command Prompt" window, don't know if it works well any other way.

Hello Kenneth,

Thanks for your reply.

You have a good knowledge of the back.

Me, this is very long I did do BATCH file.

All these functions are under the back of W7 pro 32-bit sp1.

Kind regards.

Denis

psobejko
12-Amethyst
(To:KenFarley)

Hello Kenneth, good advice and thanks for sharing your purge batch utility.

I just wanted to make you aware of a very esoteric aspect to this line in your batch file:

del *.inf.* 2> nul

This line will actually delete all files *.inf - in other words, even ones named for example, test.inf

So beware about running your batch file to clean up the entire C: drive, for it will wipe out the inf files used by the Windows OS.


One solution is to use a for-loop instead:


for /L %%n in (1,1,10) do (

del *.inf.%%n 2> nul

)

further discussion here:

http://www.mcadcentral.com/creo-data-management/9622-purge-thru-all-folders.html

Interesting. I've only run this on file servers. The huge directory tree where we store all of our CAD data and other such stuff. Regardless, I probably want to remove that little item from the list, just in case someone tries to use it in a different sense than intended.

Technically, Purge.exe should do this for you in the command prompt window for a complete folder.

Problem is, a lot of installations didn't recognize purge as a DOS command due to some mis-located or wrongly path'd DLL files.

Kenneth... THANKS!

Yeah, we have had this "habit", since the dawn of time (Pro/E V8.0?, around 1994) of copying the "purge.exe" executable into every directory we work on. Then you can double click it in an explorer window and it handles that one directory.

I wrote the recpurge thing a while ago, back when our file server had a relatively small hard drive. Some directories that might have "really" needed 10-20 Mb of space were using 500-ish because of massive numbers of old version files. With this thing I was able to keep the old hard drive hobbling along for quite a while. Plus, it really speeds up things when you need to do a search.

ProESite - Olaf Corten's Pro/ENGINEER Site - Pro/E Utilities, Benchmark, Tips and Links

Check out CreoPurge found in the Utilities section of the above web site. We've installed it on all users computers. It works with a simple right click.

DenisJaunin
15-Moonstone
(To:kross)

Hello Kevin,

Thanks for reminding me this site, that I had forgotten.

I'll enjoy to see what's new.

Kind regards.

Denis

Hello Denis,

if either (or both) suggestions (batch script using purge.exe or CreoPurge) helped you solving your issue, please get back to the thread, share your experience and mark the thread as answered (by selecting the most appropriate post as Correct Answer).

Thanks,

Gunter

Hello

Here is a link that may be of interest to those who want to do selective purges.

Kind regards.

Denis

http://www.inneo.de/produkt/genius-tools-purge/?tx_powermail_pi1[mailID]=22957&cHash=63e1c53ed9dd17c9f5685d61cf089a92#c22957

This is the direct link to the CreoPurge tool: OCUS PTC Utility: CreoPurge

Top Tags