Novell Home

How to scan erased files (CLIB)

From Developer Community

This code demonstrates how to scan erased files in a directory with ScanErasedFiles()

Sample Code

#include <nwfile.h>
#include <nwfinfo.h>
#include <stdio.h>
#include <stdlib.h>

int main( int argc, char* argv[]) {
  long nextEntryNumber = -1;
  static DIR deletedFileInfo;
  if ( argc != 2) {
    printf( "Syntax: %s <dir_name>\n", argv[ 0]);
    return EXIT_FAILURE;
  }
  while ( ScanErasedFiles( argv[ 1],
    &nextEntryNumber,
    &deletedFileInfo) == 0) {
    puts( deletedFileInfo.d_name);
  }
  return EXIT_SUCCESS;
}

--Dmitry Mityugov

Novell® Making IT Work As One

© 2008 Novell, Inc. All Rights Reserved.