cancel
Showing results for 
Search instead for 
Did you mean: 

Automatically delete archive files

Former Member
0 Kudos

Hi SDNers,

I have a requirement to delete the already processed inbound archived files. Is it possible to delete them

Thanks in Advance

Dilmit Chadha

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Yes you can delete the files present in Ready and Archive folder.

Follow the below steps:

1. Create a text file which contain the below lines:

cd {MDM Installation Path}\Server\......\Archive

del star . star /q

Note: Instead of writing "star" use star symol

E.g. C:\Program Files\SAP MDM 5.5 Server\Distributions\Test-MDM_MSQL\Test-Repo\Inbound\Remote_sys\Inbound_port\Archive

2. Save the file with .bat extension.

3. You can schedule this file using Windows Schedular. For this go to Start -> Programs -> Accessories -> System Tools -> Scheduled Tasks and create a new one by double clicking on it. Select the bat file created and accordindly schedule it like daily, weekly etc.

4. Now whenever the task is due it automatically executes the commands written in bat file and deletes all the files from Archives folder.

Regards,

Jitesh Talreja

Former Member
0 Kudos

Hi Jitesh,

I have tried doing this part of scheduling the bat file. But my files are not getting deleted from archive folder. In the .bat file I have written the following things:

cd cd {MDM Installation Path}\Server\......\Archive

del star . star

and then I have scheduled this file to be run in windows scheduller. But after this, files were not deleted from the archive folder

Please let me know if I am missing something.

Thanks & Regards

Dilmit Chadha

Former Member
0 Kudos

Hi Dilmit,

It is working at my end.

cd cd {MDM Installation Path}\Server\......\Archive

del star . star

There will be only one cd instead of 2 and for start you need to use asterik i.e. star symbol. Also save the .bat file in C drive i.e. C:\test.bat

Regards,

Jitesh Talreja

Former Member
0 Kudos

Hi Jitesh,

Thanks, my problem is solved. I had saved my file in different location and for this reason it was not deleting the files.

Points awarded

Thanks & Regards

DIlmit Chadha

former_member198313
Contributor
0 Kudos

Dilmit,

Give command *del . /Q /F* instead of del .

it will take care of it.

+ An

Answers (1)

Answers (1)

Former Member
0 Kudos

You might be interested in this small piece of Windows command file which I wrote to delete files over 60 days old from all the port distribution folders. The script will read the MDM mds.ini file to determine the location of the distribution directory, then execute the windows 'Forfiles' command recursively in that directory and delete any xml file over 60 days old. You should be able to adjust this slightly for your needs.

set root=

for /f "delims== tokens=1,2 usebackq" %%i in ("d:\program files\sap mdm 5.5\server\mds.ini") do if "%%i"=="Distribution Root Dir" set root=%%j

if "%root%"=="" (

echo No import server distribution directory found

) else (

pushd %root%

forfiles /s /d -60 /m *.xml /c "cmd /c del /q @path"

popd

)