Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

purge thru all folders

megaladon

New member
i currently have a project folder with sub folders and sub folders in those and so on


i have a purge tool that deletes all .inf .crc and so on but currently i must right click the folder and and hit purge and it works great but i would like to high light project folder and have it purge all subfolders at same time


i found this on the web but im not a programmer and im not going to pretend i know what it says


FOR /R C:\temp\ %%G IN (*.bak) DO del %%G


is there a better way than this?


here is my current batch for purging


del *.ger*
del *.crc*
del *.memb*
del *.ers*
del iges_stats.dat*
del *.bde
del *.bdi
del *.bdm
del *.m_p*
del *.bom*
del *.ptd
del *.als
del *.out
del *.pls
del *.tst
del *.sec*
del *.ref*
del *.info*
del *.shd*
del *.err*
del *.idx*
del trail.txt.*
del style.out
del current_session.pro
del *.sec.*
del *.inf.*
del *.log
del *search.pro
del *acadstk.dmp
del *.usr.*
del feature.lst
del *.lsl.*
del *out.log.*
del *.rpt
del *.idx
del errors.lst.*
del outdated.lst.*
 
Here is the text of a batch file we use for purging a folder & it's subfolders.
I would recommend that you copy your purge.bat file, rename it & add all of the files you want to delete to the copy. Use the replacement in this batch file.


rem *** start of batch file
echo off
cls
rem change this path to your Pro/E <loadpoint>/bin
rem =======================================
set path=c:\ptc\proe2001\bin;%path%
rem switch to selected directory
rem =======================================
cd /d "%1"
echo About to recursively purge the following directory:
echo.
echo %1
echo.
echo.
pause
rem purge the originally selected directory
rem =======================================
start /B purge.bat
rem now purge all subdirectories under that one
rem =======================================
for /f "delims=[" %%a in ('dir /s /b /ad') do (
cd /d "%%a"
echo %%a
start /B purge.bat
)
rem *** end of batch file


Alternatively, you could search for the Spekan purge utility - there have been a few postings with a link to it.
 
...hey... I recognize that code!


[url]http://www.eern.com/2005/09/05/right-click-purging-in-window s/[/url]


smiley1.gif
 
Looking at the list of things you want to delete I would definitely rewrite some of them if you're going to make it recursivebecause if you run that on the wrong folder or at the root folder you could damage Windows badly.


Specifically *.inf.* would do some real harm to Windows. Just because you specify the second "." doesn't mean it's used. Deleting *.inf.* would also remove a file named test.inf even if there is no second ".".


I would add the # to the end like *.inf.1* or put it in a "for /l"loop with (1,1,9) to get all of them.
 

Sponsor

Back
Top