Still very much a noob with PowerShell, so pardon me if I'm missing something obvious.
We get some flat text files from a vendor and occasionally see corruption in one or more of the files. When this happens, the file will start with a bunch of null characters (x00), or end with nulls. I have a script that reads each file line for line checking for nulls, but since some of these files can be tens or hundreds of MB in size, its just taking too long.
All I really need to do is look at the first byte of the file, then the last byte, to see if either one of them are null. Using $line = $fileReader.ReadLine() to read every line in every file takes forever on those big files!
Please tell me there's an quicker way to do this!