Click here to Skip to main content
11,477,007 members (76,076 online)
Click here to Skip to main content

Find and delete NTFS Alternate Data Streams (ADS )

, 19 Oct 2005 LGPL3 52K 618 25
Rate this:
Please Sign up or sign in to vote.
A GUI extension of the NTFS library written by Richard Deeming.

Introduction

Do you know what are NTFS Alternate Data Streams? If not, look at Accessing alternative data-streams of files on an NTFS volume, a Richard Deeming article. There you can download the sources and binaries of the NTFS.dll used in my project.

This project is a Windows GUI extension that allows you to Find and Remove all the interested data streams stored on your local drive or a network folder.

The data is returned in a DataGrid and you can sort it by stream name, size, location and file name.

Using the Form

The core of the form uses a recursive search, and each file found is stored into an ArrayList, and so is all the streams information of the file.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using NTFS;
using System.Threading;
...
private void DirSearch(string sDir, bool subFolders)
  {
   try
   {
    foreach (string f in Directory.GetFiles(sDir))
    { 
     FileInfo FSInfo = new FileInfo(f);
     NTFS.FileStreams FS = new NTFS.FileStreams(f);
      
     foreach(NTFS.StreamInfo s in FS)
     {
      FileInfoStruct fis;
      fis.File_Name = FS.FileName;
      fis.Stream_Name = s.Name;
      fis.Stream_Size = s.Size;
      fis.Location = FSInfo.DirectoryName;
      fis.Creation_Date = FSInfo.CreationTime;
      ArrayFileInfo.Add(fis);
     } 
    }
    // update the results label
    String caption = "Results:  (" + 
                     this.fileInfoData1.FileInfo.Rows.Count.ToString() + 
                     ")";
    this.dataGridResult.CaptionText = caption;
    if (subFolders)
    {
     foreach (string d in Directory.GetDirectories(sDir))
     {
      DirSearch(d, subFolders);
     }
    }
   }
   catch
   {
   }
  }

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)

Share

About the Author

Marco Roello
Web Developer
Italy Italy
No Biography provided

Comments and Discussions

 
Question2TB Virtual Disk Pin
nhchmg27-Jun-11 21:16
membernhchmg27-Jun-11 21:16 
GeneralNice but incomplete Pin
Elmue21-May-11 7:43
memberElmue21-May-11 7:43 
AnswerRe: Nice but incomplete [modified] Pin
nefarius2k828-May-11 9:31
membernefarius2k828-May-11 9:31 
GeneralRe: Nice but incomplete Pin
Elmue31-May-11 1:06
memberElmue31-May-11 1:06 
GeneralADS on Directories Pin
Dave Nelson12-Oct-06 9:12
memberDave Nelson12-Oct-06 9:12 
GeneralUpdated NTFS.dll to 2.0 Pin
Moomansun23-Aug-06 14:57
memberMoomansun23-Aug-06 14:57 
I have updated the NTFS.dll to support .NET 2.0. The filestream used has been changed to support SafeFileHandle, rather than a handle to the file.

A little note to remember, if you try to run this in debug mode under Visual Studio 2005, the threads time out. Running the Release version works perfectly.

I've taken a look around for a freeware app which can list ADS and there is none. So, if there are no objections, I'll add a link to this page and release a compiled version of this very handy app as freeware.
QuestionRe: Updated NTFS.dll to 2.0 Pin
FrEaK_CH21-Sep-06 6:10
memberFrEaK_CH21-Sep-06 6:10 
AnswerRe: Updated NTFS.dll to 2.0 Pin
Moomansun21-Sep-06 8:59
memberMoomansun21-Sep-06 8:59 
GeneralRe: Updated NTFS.dll to 2.0 Pin
FrEaK_CH21-Sep-06 13:06
memberFrEaK_CH21-Sep-06 13:06 
GeneralRe: Updated NTFS.dll to 2.0 Pin
FrEaK_CH25-Sep-06 13:03
memberFrEaK_CH25-Sep-06 13:03 
QuestionChanges in NTFS.dll? [modified] Pin
FrEaK_CH7-Jun-06 7:21
memberFrEaK_CH7-Jun-06 7:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web04 | 2.8.150520.1 | Last Updated 20 Oct 2005
Article Copyright 2005 by Marco Roello
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid