--- title: "Delete files and folders on Windows devices." slug: "delete-files-and-folders-on-windows-devices" updated: 2024-05-17T15:26:10Z published: 2024-05-17T15:26:10Z canonical: "help.scalefusion.com/delete-files-and-folders-on-windows-devices" --- > ## Documentation Index > Fetch the complete documentation index at: https://help.scalefusion.com/llms.txt > Use this file to discover all available pages before exploring further. # Delete files and folders on Windows devices. The following PowerShell script helps the IT Admins to delete outdated files and folders remotely on managed Windows devices. 1. Create a file(s) on your desktop, for example, **DeleteFiles.ps1/ DeleteFolder.ps1** and open it in a text editor like notepad++ 2. Copy the contents below to the file(s). ```powershell remove-item “filename.txt” # Replace Filename.ext with Exact path of the file with the extension. ``` ```powershell remove-item "foldername_with_path" -recurse # Replace foldername_with_path with Exact path of the folder. ``` > [!NOTE] > The **–recurse** attribute ensures that all the files inside the folder are deleted. 3. Follow [our guide](/docs/deploy-powershell-scripts-using-scalefusion) to upload & publish the PowerShell script using Scalefusion Dashboard. 4. Please make sure to select the Execution Policy as below **a. Execution Level : Device** **b. Execution Context : Enrolled User** > [!CAUTION] > Please note that to use the PowerShell scripts, the Scalefusion MDM Agent Application must be installed on the device(s). Please follow [our guide](/docs/scalefusion-mdm-agent-application) to publish and install the Scalefusion MDM Agent Application. > [!CAUTION] > Notes: > > 1. The scripts and their contents are sourced from various albeit authenticated Microsoft sources and forums. > 2. Please validate the scripts on a test machine before deploying them on all your managed devices. > 3. Scalefusion has tested these scripts, however, Scalefusion will not be responsible for any loss of data or system malfunction that may arise due to the incorrect usage of these scripts.