code: private static synchronized void cleanup() {
  		int cleanedDirs = 0;
  		int cleanedFiles = 0;
  		// retrieve leftover swap directories
  		File[] swapDirs = TMP_DIR.listFiles(new FileFilter() {
  			public boolean accept(File pathname) {
  				return pathname.getName().endsWith(SWAP_DIR_SUFFIX);
  			}
  		});
  		for(File swapDir : swapDirs) {
  			// check if swap directory is locked
  			File lockFile = new File(TMP_DIR, swapDir.getName() + LOCK_FILE_SUFFIX);
  			if(lockFile.exists() == false) {
  				// no lock file, recursively delete leftover swap dir
  				cleanedDirs++;
  				cleanedFiles += deleteRecursively(swapDir);
  			}
  		}
  		System.out.println("NikeFS2: cleaned up " + cleanedFiles + 
  				" stale swap files (from " + cleanedDirs + " sessions).");
  	}
docs: Cleans up stale swap files and directories, left over from
  previous sessions. Only swap directories for which no lock
  file exists will be removed.