OAProfessor

Deep OA Product Insight

User Tools

Site Tools


deleteoldlogfiles

In rare occasions, we may need to remove files which are older than a particular date. This might be log file, Value Archive backups, etc. Always be careful about removing files unless you really understand the way the system is managing them.

There are some cool batch file techniques in Windows. You can create a .bat or .cmd file that is added to the Windows Scheduler and gets triggered at some time interval like weeks or months. Inside this file is where the magic is.

Here is a line from a batch file I created that removed log files which are more than 90 days old:

FORFILES /P C:\WinCC_OA_Proj\MyProject\log /M * /D -90 /C "CMD /C DEL @PATH"

Of course, there are other areas you might need to clean up in Oracle, BIRT, etc. This great batch command FORFILES is the key to this solution.

These deleted files are NOT in the trash can! Be careful! Always test your batch file before you put it in the scheduler.

deleteoldlogfiles.txt · Last modified: 2019/11/25 23:08 by toddmalone

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki