Managing Disk Space with SOLIDWORKS PDM Part #3: Web2.0 Temporary Session Files

Wednesday August 25, 2021 at 11:00am
In this blog series we are examining the factors influencing disk usage within PDM and what you can do to manage them. In the first part we discussed how you can re-organise your Archive across multiple drives to get you back up and running quickly should you find you are short on space. In the second part we looked at the differences between a deleted and a destroyed file and the impact the PDM recycle bin has on Disk usage. This blog is especially important to Customers who have deployed the Web2.0 interface for PDM Professional and have lots of users viewing / interacting with managed data.
Managing Disk Space with SOLIDWORKS PDM Part #3: W

Before we can manage the impact, we first need to understand how viewing a file in PDM Web2 interacts with the Vault itself.

When files are being previewed via Web2 clients, the preview information is first extracted temporarily on the Web2 server. Which information becomes extracted and how the server processes the file will differ depending on what file type is being previewed however these temporary session folders will remain on the Web2 server and will take up space as files are being accessed via Web2 clients. It is recommended that older session folders are deleted on a scheduled basis.

Regardless of file type, the following happens on the Web2 server when a client accesses and previews a file.

1. On the Web2 server, under the “..\Content\tempFiles\” folder of the Web2 server files location, each client web browser session is assigned a unique “Session ID” folder.

2. When users access files through the Web2 client, a folder structure matching the location of the file in the vault will be temporarily created under the session folder. A copy of the selected file will be retrieved from the file vault view on the server and placed in the temporary folder.

3. The file is then converted for viewing either as a lightweight eDrawings file or for viewing using the web version of the built in PDM Pro Viewer for ‘Office’ Documents / PDF’s etc

This means that over time, this folder will start to accumulate temporary files and although we can manually cleanse them, the purpose of this blog is to illustrate a method for creating a Windows scheduled task to remove session folders older than a specified number of days. To do this we will make use of a Windows command called forfiles which allows us to script a command (such as delete) on a file or set of files based on specified parameters (such as age). For a complete overview of the options and parameters available to this tool see here: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/forfiles

In this case the script we will send to forfiles via the scheduled task will be…

/P "[webroot]\Content\tempFiles" /D -30 /C "cmd /c if @isdir==TRUE rd /s /q @path"

Where you will need to replace the [webroot] text with the path to your Web2 installation.

The switches we can use are as follows:

/P - To indicate the path to start the search.

/D - Select files with a last modified date. For example, -365 means over a year ago, -30 means a month ago.

/C "command" - This command specifies the command to execute on each file that will be found. Command strings should be wrapped in double quotes.

/S - This switch makes forfiles recurse subdirectories. Like "DIR /S".

/Q – This switch makes the script run in quiet mode.

As we want to remove folders and their content we will also use the variables and instruction:

@isdir - returns "TRUE" if a file type is a directory, and "FALSE" for files.

@path - returns the full path of the directory / file.

rd - remove directory

Before we can create the Task we need to capture the path to the tempfiles folder. On your Webserver, launch IIS, locate the Web2 Application and ‘explore’ to open the root of the application.

This is the path you want to copy and add in place of [webroot] in the script shown. So, for me the path will now look like:

/P "C:\inetpub\wwwroot\SOLIDWORKSPDM\Web2\Content\tempFiles” /D -1 /C "cmd /c if @isdir==TRUE rd /s /q @path"

With this information ready we can now launch the task scheduler and create this cleaner task.

From the start menu, type ‘task’ and launch task scheduler

To keep this task separate from the built in ones, lets create a folder to store it. So, from the action menu select New Folder and create a folder of your choice (I used ‘Web2 Temp File Cleaner’)

Next Right Click that folder and select Create Task. On the general tab, specify a name for the task such as ‘Remove old Web2 Session Files’

In the actions tab, click New

Action: Start a program
Program/script: ForFiles.exe
Add arguments(optional): /P “C:\inetpub\wwwroot\SOLIDWORKSPDM\Web2\Content\tempFiles” /D -1 /C "cmd /c if @isdir==TRUE rd /s /q @path"

Click OK then switch to the Triggers tab. Click New and set up your schedule. Choosing a time when the vault is least likely to be under heavy load.

I have selected 04:00am each day

Finally, back on the general tab, select the option to Run whether user is logged on or not (Do not store password). You can also change the user account that is running the script but after clicking OK you will be prompted to enter the password for the nominated user.

If you want to test the task straight away, right click it and select Run.

Blog Series Contents

  • Part #1 : Distributing the Archive
  • Part #2 : Deleted vs Destroyed and the Vault Cleaner Service
  • Part #3 : Web2.0 Temporary Session Files
  • Part #4 : Cold Storage
  • Part #5 : Archive Compression

Related Blog Posts

Solid Solutions Management Ltd Welcomes DTE
Having acquired several key businesses over the past six years, Solid Solutions now supports a customer community of more than 15,000 UK and Ireland-based customers. These encompass product designers, mechanical engineers, manufacturers, and educatio....
Hybrid modelling SOLIDWORKS 2022
Thanks to the all-new Hybrid mesh modelling features in SOLIDWORKS 2022 you can now directly edit imported mesh bodies as if they were native parts that were designed in SOLIDWORKS. This means that features such as boss extrudes, cuts and fillets can...
Managing Disk Space with SOLIDWORKS PDM Part #5: A
In this blog series we are examining the factors influencing disk usage within PDM and what you can do to manage them. In the first part we discussed how you can re-organise your archive across multiple drives to get you back up and running quickly s...

 Part of Solid Solutions Group

MENU
Top