Table of Contents

deletefromsource

Free

Description

The deletefromsource command deletes files listed in a CSV file. It can also optionally destroy the files and export the operation results to a CSV file for auditing and reporting purposes.

Syntax

deletefromsource -filePath -destroy -csv -batch

Use -id as an alternative to -filePath for the same operand. A required target still needs one selector, even though each alternative is optional individually. See File IDs and paths for selection rules and command-specific exceptions.

Parameters

Parameter Alias Required Description
-filePath No Path to the source CSV file containing File IDs and Folder IDs. This can be outside the vault.
-destroy No If specified, files will be permanently destroyed after deletion.
-csv No Path to export the results CSV file.
-batch No Destory batch size for large folders.
-id No Positive PDM file ID instead of -filePath, identifying the same file that -filePath describes (including a macro, input CSV or existing output file). Requires a connected vault. Shared files with multiple locations require an exact -filePath. Resolving the ID itself does not download, check out or check in the file; the requested command still performs its normal operation.

IMPORTANT NOTES ABOUT -destroy:

The deletefromsource command first attempts to delete and destroy (if -destroy used) files normally using the provided input (IDs from the CSV).

After that initial pass, it performs a second step using the Name column. This is specifically for files that were already deleted but not destroyed. Since these files no longer exist in the vault in a normal state, they cannot be deleted again and their IDs do not exist anymore. Instead, PDMShell uses the file name to locate these previously deleted items and destroy them directly.

This approach allows you to:

  • Handle active files (delete → destroy)
  • Handle already deleted files (destroy only) if there a value in the name column. See structure of the CSV file.
Important

For previously deleted files, you only need to provide the file name in the Name column.

Source CSV Format

The source CSV file must contain a header row with the following columns:

FileID,FolderID,Name
12345,678,1.sldprt
12346,678,2.sldprt
Important

The Name column is optional. PDMShell uses this value to destroy items. You can enter the names of files that were previously deleted; PDMShell will attempt to delete them (which will fail) and then proceed to destroy them.

Column Description
FileID The document ID of the file
FolderID The folder ID containing the file

Results CSV Format

If -csv is specified, PDMShell will generate a results file containing:

FileID,FolderID,Error
12345,678,"DELETE error: File Not Found"

Results CSV Columns

Column Description
FileID File ID
FolderID Folder ID
Error Error message

Remarks

  • The source file must be a CSV file with a header row.

Examples

## Delete files from CSV:
deletefromsource -filePath "files to delete.csv"
##Delete and destroy files:
deletefromsource -filePath "files to delete.csv" -destroy
## Delete, destroy, and export results:
deletefromsource -filePath "files to delete.csv" -destroy -csv "results.csv"
## Delete, destroy (50 files at a time in each folder), and export results:
deletefromsource -filePath "files to delete.csv" -destroy -csv "results.csv" -batch 50