We need to clean up the files/subfolders from the following folders:

D\Tridion\web\preview - Daily

D\Tridion\web\Upload - Daily

C:\temp - Monthly

//configured in service config
D\Tridion\bin\transactions - Daily, files older than 5 days

D:\tridion\bin\log - Weekly (Please suggest)

D:\tridion\log - Weekly (Please suggest)

Importantly, for some of the folders it is configured in different services. Could you please tell how this can be achieved?

Now, we want to achieve this using a batch job. Please suggest and share your views.

As of now , i have something like (A .bat scheduled)for the folders (sample): Could you please tell if this has any impact or drawbacks, though it is working

@echo off

:: set folder path

set dump_path=D:\Tridion\log\

:: set min age of files and folders to delete

set max_days=5

net stop "Tridion Content Manager Publisher"

:: remove files/subdirectories from %dump_path%

forfiles -p %dump_path% -s -m . -d -%max_days% -c "cmd /c del /q @path"

:: remove empty directories

dir /ad /b /s %dump_path% |sort /r >tmp.tmp for /f "delims=" %%a in (tmp.tmp) do rd "%%a" 2>nul del tmp.tmp

net start "Tridion Content Manager Publisher"

I am not powershell expert, but will try to do somthing taking reference from the script by Chris. Thanks to all of you for your valuable inputs and help.

  • Not really sure if this question belongs here, it is related to SDL Tridion, but not really a specific SDL Tridion question. I'll allow it for now and will monitor what the community thinks of it (they can raise flags to close). I'm sure the SDL Tridion community can come up with an answer, but in my opinion it has a better fit in serverfault.com. So if it gets closed before you get a satisfying answer, don't feel bad and just repost it on Server Fault. Jul 18, 2013 at 13:00
  • I'd say it's a straight-up Tridion question. Yes - it's about infra, but it refers to folders which are "owned" by various pieces of a Tridion installation, and where the clean up task may occasionally interact with Tridion services, logging configurations etc. Jul 21, 2013 at 18:19
  • Hi Dominic, Is there any automation script (.bat) to see if there are any items in publishing queue "In Progress" status , before stopping the publisher service. Jul 23, 2013 at 11:33

1 Answer 1


Chris Mills wrote an excellent Tridion Scheduled Maintenance Tasks post and script a while ago.

This may need to be modified for newer versions of Tridion and could possibly be rewritten in Powershell, but it would give you a start.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.