Need Help Organizing PDFs and PNGs with PowerShell

0
0
Asked By TechieDude42 On

Hey everyone! I'm a beginner support engineer at a hospital and I'm working on a project involving a folder structure for consultation IDs. Each folder has two subfolders: one for reports (which contains PDFs) and one for image sets (which has PNGs). My goal is to match the PDF files with the corresponding PNG images based on patient details like name and consultation day. I want to create a new structure where each folder is organized by patient name and consultation day, and separate out any unused images that didn't match with the reports. So far, I've extracted patient details from the PDFs, but I'm stuck on how to match the PNGs and create the desired folder structure using PowerShell ISE. Any suggestions or guidance would be really helpful!

3 Answers

Answered By DataWiz On

Have you considered using metadata for the images and PDFs? This would simplify the sorting process immensely since you could access the necessary info without moving files around unnecessarily. It just makes everything cleaner.

TechieDude42 -

I see where you're coming from, but I'm not sure how to implement that. I'm still learning the basics, so any pointers on tools for using metadata would be great!

Answered By FileMaster89 On

To start off, it might be helpful to create a temporary folder where you can dump all the files for easier access. From there, you can use a CSV with all the patient names to create new folders for each. I’d suggest writing a script to loop through the temp folder, matching the PDFs and PNGs using regex against patient names. That way, corresponding files get sorted into their respective folders, and you can manually review anything that doesn't match.

ConsultGuy77 -

I initially did something similar by converting all PDFs to text files. It made my life easier to handle the data with PowerShell. But yeah, lacking a patient list definitely complicates the process. You might still find regex helpful for matching.

Answered By StorageSaver On

It's important to clarify the purpose behind this organization. If it's primarily for archiving, you wouldn’t want to automate unless it’s necessary. The main goal should be to reduce disk space by keeping only the images used in the reports while preserving the full sets. I've been using Python to extract and compare images from the PDFs, which seems to work well for my needs.

TechieDude42 -

Exactly! That’s the reason I want to do this. It’s a lot of data to manage and keeping only what’s needed will save us a ton of space without cluttering the drive.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.