Re: Script to remove network log/trace files

  • From: Yechiel Adar <adar666@xxxxxxxxxxxx>
  • Date: Mon, 08 Jan 2007 13:50:23 +0200

Hello Dex

I had the same problem and did not found any way to copy or delete or move files that are older then 30 days in windows.
I used a utility called robocopy to do this.

After your question I researched some more and found a way to do it, using a small sql script to generate cmd file that will do the work.

set heading off
spool c:\temp\deltraces.cmd
select 'cd  /d  d:\oracle\ora92\admin\udump' from dual;
select 'md temp'  from dual;
select 'xcopy * temp /D:' || to_char(sysdate-30,'MM-DD-YYYY') from dual;
select 'delete . /Y' from dual;
select 'move temp\* .' from dual;
select 'rd temp' from dual;
spool off
exit

The trick is that xcopy have the /D switch that copy only files with dates greater then the date in the /D switch. So, you copy the files you want to keep, delete all files in the directory and then move the files back.

Adar Yechiel
Rechovot, Israel



J. Dex wrote:
Does anyone have a script for Windows that will archive old network log and trace files and also remove any that are more than a month old (or at least be able to run under a monthly scheduled task)? I have done this in UNIX but not on Windows.
--
//www.freelists.org/webpage/oracle-l


Other related posts: