i have 10 pdf files in folder, i want copying those files in folders on another location, but if statement is name folders must be same like contain in files. then if contain file for example john smith, this file will copy in folder with name john smith.
i have code which works on txt files
$folder=get-childitem V:\ ; $file=get-childitem c:\test\ -filter*.txt-recurse; foreach($foldernamein$folder){foreach($filenamein$file){$filecopy=$filename|get-content-filter$foldername.Name; if($filecopy-eq$foldername.Name){copy-item$filecopy.PSPath$foldername.FullName; }}}
i have code for reading one pdf file
[System.Reflection.Assembly]::LoadFrom("C:\Scripts\PdfToText\itextsharp.dll") Add-Type -Path 'C:\Scripts\PdfToText\itextsharp.dll' $reader = New-Object iTextSharp.text.pdf.pdfreader -ArgumentList "$pwd\test.pdf" for ($page = 1; $page -le $reader.NumberOfPages; $page++) { $lines = [char[]]$reader.GetPageContent($page) -join "" -split "`n" foreach ($line in $lines) { if ($line -match "^\[") { $line = $line -replace "\\([\S])", $matches[1] $line -replace "^\[\(|\)\]TJ$", "" -split "\)\-?\d+\.?\d*\(" -join "" } } }how connect both codes or maybe the better solution?
thanks
- Edited by gogi1000 Friday, May 22, 2015 1:08 PM error