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

Managing-Disk-Space-With-Solidworks-Pdm-Part-3-W

Published: Jul 30, 2021
| View All Blogs

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.

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 “..ContenttempFiles” folder of the Web2 server files location, each client web browser session is assigned a unique “Session ID” folder.

pdm03 9

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.

pdm03 10

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]ContenttempFiles” /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.

pdm03 11

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:inetpubwwwrootSOLIDWORKSPDMWeb2ContenttempFiles” /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’)

pdm03 12

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’

pdm03 13

In the actions tab, click New

Action: Start a program
Program/script: ForFiles.exe
Add arguments(optional): /P “C:inetpubwwwrootSOLIDWORKSPDMWeb2ContenttempFiles” /D -1 /C “cmd /c if @isdir==TRUE rd /s /q @path”

pdm03 14

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

pdm03 15

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.

pdm03 16

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

Categorised as: |

Get a SOLIDWORKS Quote

Interested in SOLIDWORKS? Contact us for questions, trials, or demos by clicking the button below or call 01926 333777. Our experts will help you find the perfect solution.

proteus-exploded-view-dramatic-alpha-solidworks-visualize-overlay

Related Posts

How to Find Reaction Forces in SOLIDWORKS Simulation

SOLIDWORKS helps us to find resultant forces through simulation studies. These virtual tests reduce the need for physical prototypes and give us an accurate answer.

Setting number of decimal places in a table on a drawing

When creating an equation in a drawing general table, is it possible to define the…

Why is my Flat Pattern not showing in SOLIDWORKS Drawings?

This may be linked to how the drawing is saved or it can be related to how sheet metal parts are displayed in drawings, read on to find out how to fix it.

Why is SOLIDWORKS Crashing?

It’s one of the great mysteries of life – why is SOLIDWORKS crashing? Let’s explore how SOLIDWORKS crashes and how we can improve performance in SOLIDWORKS.

Tech Support Blog: Why are my SOLIDWORKS BOM Quantities Wrong?

Why are my SOLIDWORKS BOM Quantities Wrong? A support call cropped up this week which…

How to Get Your Serial Number for SOLIDWORKS Visualize Standard

Want to download Visualize to make photorealistic renders? Follow this guide for accessing your Visualize serial number that comes bundled in with SolidWorks Professional and Premium.

How to Recover SOLIDWORKS Files After a Crash

SOLIDWORKS has two different methods to help you recover from an unexpected crash or loss of data in the form of auto-recovery and back-up settings.

SOLIDWORKS Magnetic Mates

Magnetic makes are used within SolidWorks assemblies to easily configure and position assembly components. Through defining connection points and ground plane(s) – position components through drag and dropping one component within close proximity of another to snap the asset into position.

SOLIDWORKS Dimensions – Collated Quick Tips

We have collated some of our favourite tips on creating, manipulating and controlling dimensions in SolidWorks, both at a sketching and drawing level. Read on to find out more…

How to Deactivate (Transfer) a SOLIDWORKS License

A SOLIDWORKS standalone license can only be activated on one machine at a time. If you plan on moving your SOLIDWORKS license to another machine you will first need to deactivate it. Additionally if a standalone license has ended up on multiple machines or you are making a change to your computer, you will need to deactivate the license first.