Reputation: 23
Everything works except the Substring(). I want to use the left 10 bytes of the file name for the folder name to save the files in.
Error Msg: Method invocation failed because [System.IO.FileInfo] does not contain a method named 'Substring'.
PowerShell code:
$Filter = "*.SCNX"
$files = @(get-childitem -path $OutBoxPath -filter $filter)
Write-Host 'File Count? ' $Files.count
foreach ($file in $files) {
Write-Host 'File ' $File
Write-Host $File.Substring(0,10)
}
Upvotes: 1
Views: 53