Click here to Skip to main content
Licence 
First Posted 19 Oct 2005
Views 43,066
Bookmarked 24 times

Find and delete NTFS Alternate Data Streams (ADS )

By | 19 Oct 2005 | Article
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 has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Marco Roello

Web Developer

Italy Italy

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Question2TB Virtual Disk Pinmembernhchmg20:16 27 Jun '11  
GeneralNice but incomplete PinmemberElmue6:43 21 May '11  
AnswerRe: Nice but incomplete [modified] Pinmembernefarius2k88:31 28 May '11  
GeneralRe: Nice but incomplete PinmemberElmue0:06 31 May '11  
GeneralADS on Directories PinmemberDave Nelson8:12 12 Oct '06  
How would I use this to find ADS on a folder instead of just files?
 
Atribune
GeneralUpdated NTFS.dll to 2.0 PinmemberMoomansun13:57 23 Aug '06  
QuestionRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH5:10 21 Sep '06  
AnswerRe: Updated NTFS.dll to 2.0 PinmemberMoomansun7:59 21 Sep '06  
GeneralRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH12:06 21 Sep '06  
GeneralRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH12:03 25 Sep '06  
QuestionChanges in NTFS.dll? [modified] PinmemberFrEaK_CH6:21 7 Jun '06  

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.

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