Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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? – kate 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. – kate Jan 8 '11 at 21:49

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .