Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have some folders which contain files (old temp P2P files saved wrongly apparently) which are just filled with zeros - any program/batch that can verify this ? I do not want to open each one with a hex editor

share|improve this question
    
What kind of files ? –  Sathya Jan 2 '11 at 4:29
    
023.part - bunch of zeros - there are too many to check all of them individually –  Mr_and_Mrs_D Jan 2 '11 at 13:22
    
About what size are the files? –  kim Jan 4 '11 at 9:17
    
Anything from a few megs to a few gigs –  Mr_and_Mrs_D Jan 4 '11 at 14:33
1  
(Oops, continued from above.) For example, using the standard CRC-16 algorithm, a file containing the hex byte 01 will have a little-endian CRC of C0C1; appending the hex bytes C1 C0 to the file will cause it to have a CRC of zero. –  kim Jan 8 '11 at 21:49

1 Answer 1

Though it runs the risk of false positives (like most CRC-based solutions), if PowerShell and a Java runtime environment are installed, it is possible to do approximately what you're asking for after downloading and extracting Jacksum.

Adapt the following command (the $jacksum_root_directory variable should have no trailing slash), then open PowerShell and run it to get a listing of files with a checksum of zero:

$jacksum_root_directory = 'drive:\path\to\directory'
$jacksum_jar_location = 'drive:\path\to\jacksum.jar'
java -jar $jacksum_jar_location -E dec -F "#CHECKSUM #FILENAME" -a crc64 -p -r -f $jacksum_root_directory | where { $_.StartsWith('0 ') } | foreach { get-item $_.Remove(0, 2) }

All zeroed-out and empty files will have a checksum of zero and should show in the listing, but it's possible that other, non-zeroed files may also have a zero checksum.

When you feel confident that the files listed can be safely deleted, they can be deleted automatically by replacing get-item with remove-item in the third line and re-running the command.

share|improve this answer
    
thanks - will be trying this ASAP –  Mr_and_Mrs_D Jan 12 '11 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.