Skip to content

Instantly share code, notes, and snippets.

@kstrauss
Last active September 27, 2018 14:08
Show Gist options
  • Save kstrauss/eb99f398d191426038067ab15a6a951a to your computer and use it in GitHub Desktop.
Save kstrauss/eb99f398d191426038067ab15a6a951a to your computer and use it in GitHub Desktop.
a dumb way of matching up filenames to a list of names on the clipboard.
<#
https://gist.github.com/kstrauss/eb99f398d191426038067ab15a6a951a
Get filenames of PDF files, which are supposed to match the customer names in the sales Requests/Commission reports.
Potentially this should be limited to only a set of files from a certain period ??
#>
Cd 'Z:\CUSTOMER SERVICE\Customer Executed Contracts\ENDURE MARKETING'
$fnames = dir *.pdf | %{ $_.basename}
<#
Go copy the customer names you want to compare against. (i.e. go to excel and select the customer
Names for those that
#>
$cnames = get-clipboard
Write-host "There are $($fnames.length) files and $($cnames.length) customers"
<#
Compare the different lists
#>
$compareResults = Compare-object $cnames $fnames
$filtered = $compareResults | ? {$_.SideIndicator -eq '<='} | %{ $_.InputObject}
Write-host "Customers that do not have an exact file name match."
$filtered | out-gridview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment