Submit a ticketCall us

Webinar: Web Help Desk for HR, Facilities and Accounting Departments
This webinar will focus on use cases for HR, Facilities and Accounting.

Having a unified ticketing and asset management system for all the departments in your company can provide end-users with a seamless experience and make things easier for your IT team. Yet, with different business tasks and objectives, many departments don’t fully understand the capabilities of Web Help Desk and how the software can be customized for effective use in their departments.
Register Now.

Home > Success Center > Serv-U Managed File Transfer & Serv-U FTP Server > Delete old files in Serv-U

Delete old files in Serv-U

Table of contents

Updated October 6, 2016


Some users may want to remove files after uploading or downloading.


All Serv-U versions


  1. If you do not already have them, create a local folder for Serv-U batch files and a local folder for Serv-U logs.
  2. Create a batch file called deletefileafterdownload.bat in your Serv-U batch file folder. Copy/paste this text in:
    time /t >> D:\local\ServU_One\Log\DeleteFileAfterDownload.log
    echo Deleted %1 >> D:\local\ServU_One\Log\DeleteFileAfterDownload.log
    del %1 >> D:\local\ServU_One\Log\DeleteFileAfterDownload.log
  3. Before you save the batch file, change the log path ("D:\local\ServU_One\Log") to your Serv-U log path.
    Note: Do not worry about creating the "DeleteFileAfterDownload.log" file. When Serv-U runs this batch file, it will be done automatically.
  4. Create a new domain-level event called "Delete File After Download"

Event type: File Download
Event Name: Delete File After Download
Enable Event: Checked
Description: (write which folders this applies to)
Action: Execute Command
Executable Path: (full path of deletefileafterdownload.bat)
Command Line Parameters: $LocalPathName
Completion Wait Time: 0

5. Flip to the "Event Filters" tab on your new event and add an Event Filter:

Name: Just Folders Named (whatever your folder criteria are)
Logic: (doesn't matter if you only have one filter rule)
Filter Enabled: Checked
Description: (optional)
Variable: $PathName
Comparison: = (is equal to)
Constant = *dad* (change as necessary; just "*" will match all)
Data Type = (abcd) string

6. Test the process:

a. Sign on as an end user.
b. Download a file from a folder that should trigger the event.
c. Check that the event firing was noted in the Serv-U domain log, and also check that a new "Deleted (filename)"     entry appeared in the DeleteFileAfterDownload.log file. Also refresh your directory listing in the client you used       to perform the download to verify that the file is gone.
d. Now download a file from a folder that should NOT trigger the event and check that the event did not fire.



Last modified
19:33, 5 Oct 2016