Procedure - Rename a PDF document and move it to a specific folder on the network

NICK COLLINS used Ask the Experts™
Good Morning,

I am trying to tidy up some scripts and merge them into one..

The process is as follows..

  1. PDF is automatically downloaded to a folder - The folder name is based on the current date - Format YYYYMMDD - The PDF document is named as follows PPE_000035_1067414.pdf.  PPE_??????_???????.pdf the letters are always standard but the numbers always change.

  1. The next process is that a CSV file is automatically downloaded named as follows 'template_c9b825a390544c7b98b57022e0593e44.csv' stored in a folder. Within this file I need extract the PDF ID and the date. There can be multiple entries. See example file
  2. template_c9b825a390544c7b98b57022e05.csv
  3. From this CSV file I want to extract  rows where datetime      Date: and textsingle      PPE No. - are shown columns A & B then extract the corresponding data in column C but each of set of data starts from section Title Page. The data extracted in the example should be as follows and saved in a file
  4. PPE_000036_1067414, 05/03/2019 07:35
  5. PPE_000037_1067414, 05/03/2019 08:40
  6. The next process is to rename the PDF file that was downloaded earlier in the YYYYMMDD folder.
  7. I would like the script to search for the PDF folder document in the YYYYMMDD folder based on the data that was extracted from the CSV file, 1st Column name of PDF File and once a match has been found append the data at the end of the filename. Removing any illegal characters etc and adding underscore as the separators.
  8. PPE_000036_106714_05_03_2019_07_35_AM.pdf
  9. The final process is to move the renamed files to a central location on the network
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Most Valuable Expert 2015
Distinguished Expert 2018
Nick, please have in mind, that we all are volunteers - you can't expect to receive complete solutions to a very special task that seems like a job for a paid consultant.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial