Manage PDF drawing revisions safely with PowerShell

Published · Updated

Save

Group files by drawing identifier and parse the revision from an agreed filename format. Build a plan first, so a malformed filename or duplicate revision cannot cause an automatic overwrite.

Build a repeatable inventory

Use Get-ChildItem -LiteralPath $source -File -Filter '*.pdf'. Extract a numeric or letter revision with an explicit pattern and sort according to the drawing convention. File modification time can change during a copy, so record it separately from the drawing revision. Hold unmatched names and ties for review.

Preview the archive operation

Export the proposed source and destination paths before copying. Use Copy-Item -LiteralPath $file.FullName -Destination $destination -WhatIf for a rehearsal. Reject existing destination names, then compare file hashes for a small approved batch. Keep the originals until the archive is verified.

References

PowerShell Get-ChildItem

PowerShell Copy-Item and WhatIf

Discuss this answer