Need to search for multiple values and copy the findings to a folder.

I have a file with 10000 values. I need to search for these values on a Server folder and once found, need to copy the
file to another folder. The values to search for are in one column in a spreadsheet. Values attached. They are PDF's.

How can I accomplish this?
Who is Participating?
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
OK working with Excel spreadsheet is complicated
because you would need to create a COM object then open the book, search the workbook and get the whole columns until they are empty.

I'd suggest to just open the excel file with ms excel and save it as "CSV (windows)". you would get something like the file attached it.
Also, you need to expand your question to add the "source" and the "target" paths, and what is the "SEARCH criteria" in the source path, if it's gonna be recursive or not.

Then save this into a file with extension .ps1 (ex: script.ps1)
$invocation = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$CsvFile = $invocation + '\Book1.csv'

Import-Csv $CsvFile | %{
  #Searchlogic and findings
    $_."Original PO #"

#Copy Logic

Open in new window

So, the files to be search and (conditionally) moved are PDFs?
maximus1974Author Commented:
Yes, they are PDF.

Source: \\ntapp\Z_ACCT\Z_CERTS\CERTS\Purchase_Orders_Certs
Destination: C:\LOT_SALE_ARO
Search criteria: All files that match the values in the list  

However, there are times where the files have a suffix of A, B, C, etc...
Ex. 2050496, 2050496A, 2050496B, 2050496C, etc...

I would like to copy all files starting with the value in the list to the destination.
are you searching the content of the PDFs or the file name of the PDFs?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.