MEX Blog Article

Managing Temporary Report Files in MEX V15

Managing Temporary Report Files in MEX V15

Each time a Report is generated, MEX stores a temporary copy of this on the application server that it is installed on. This includes not only when Reports are printed or emailed from the Reports module, but also when things like Work Orders and Purchase Orders are printed.

These files are located on the server which the application is installed on, in the MEXData directory (by default, at C:\inetpub\wwwroot\MEXData), then under the ‘Reports’ folder.

MEX Reports Folder

In here, you can find the temporary files created from when reports have been generated or printed out

Temp Files in Repors folder

Depending on how often you produce Reports or print from within MEX, this folder’s size can become quite large and take up space on the server. The files from within this folder can be cleared periodically to free up space – make sure that you are not deleting the folder itself, only the files within it.

NB: If you use the iOS app to email WOs, clearing these files will cause the WO hyperlink in the email to break. If you use this function of the app it is recommended to leave these files in place, or schedule a planned clearance of the files so staff can plan around this.

Using a batch file, you can choose to remove any file with a .PDF extension. To create a batch file, simply open notepad and enter the following:

  • del "C:\inetpub\wwwroot\MEXData\Reports\*.pdf"
  • START CMD /C "ECHO Temp MEX files successfully cleared && PAUSE"

del refers to ‘Delete’, so it will delete anything matching this file description.

The file path here is the default directory – make sure you double check if your application files happen to have been renamed as you may need to change this.

The *.pdf at the end of the file path will make sure all files with a PDF extension will be deleted. (Asterisk represents a wildcard).

The last part of the script displays a message that says “Temp MEX files successfully cleared” in a command prompt window.

Then, save this as a batch file, by going to File > Save As. Name it something like ‘Clear MEX temp files’, and add a ‘.bat’ file extension to the end. Make sure you select ‘All files’ under the ‘Save as type:’ dropdown.

Clear MEX Temp Files BAT

To test this, run this batch file and check the results. You should see every PDF file in the Reports folder be deleted, and a confirmation message pop up:

Command Prompt Confirmation MEX

Next, we want to schedule this to run. Open your start menu and type in ‘Schedule tasks’ and open up the Task Scheduler:

Open Schedule Tasks 

Then, on the right-hand side, select ‘Create Basic Task…’:

Create Basic Tasks

On this first screen, let’s enter a name and description for the task. Something like;

  • Name: Clear temporary MEX PDF report files
  • Description: Deletes temporary MEX PDF report files from the Reports directory in the application files.

On the next screen, let’s set the frequency. In this example, we’re going to select ‘Monthly’.

Task Wizard 1

On the next screen, let’s select which months we would like to clear it on. If you would like to go every month, select every month from the ‘Months’ dropdown. If you would like a different frequency, like quarterly, or every 6 months, then select just those months.

Under Days, let’s just select ‘Last’ – which means it will run on the last day of any given month. (Alternatively, using the ‘On’ dropdowns, we can select a frequency by days of the week, like on the last Friday of any given month, etc. This may be useful if you don’t work over weekends, then you can clear it on the last Friday of every week as an example.)

On the next ‘Action’ screen, we’re going to select to ‘Start a program’.

On the next screen, underneath ‘Program/script’, we’re going to select ‘Browse’ and navigate to the batch file we created earlier, and leave ‘Add arguments’ and ‘Start in’ blank:

Task Wizard 2

On the final ‘Finish’ screen, you have the opportunity to confirm the settings of the task. Once you’re happy, click Finish to finalize the task.

If you need a hand with managing temporary report files in MEX V15 our support team is always on hand to help you out. Contact support on +61 7 3392 4777 or email support@mex.com.au

Tech Tips MEX V15

Exciting News! MEX Maintenance Experts has been acquired by TMA Systems, expanding our global reach and capabilities. Read the full press release here.