Click here to Skip to main content
Click here to Skip to main content

Find and delete NTFS Alternate Data Streams (ADS )

By , 19 Oct 2005
 

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)

About the Author

Marco Roello
Web Developer
Italy Italy
Member
No Biography provided

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

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
Question2TB Virtual Diskmembernhchmg27 Jun '11 - 20:16 
GeneralNice but incompletememberElmue21 May '11 - 6:43 
AnswerRe: Nice but incomplete [modified]membernefarius2k828 May '11 - 8:31 
GeneralRe: Nice but incompletememberElmue31 May '11 - 0:06 
GeneralADS on DirectoriesmemberDave Nelson12 Oct '06 - 8:12 
GeneralUpdated NTFS.dll to 2.0memberMoomansun23 Aug '06 - 13:57 
QuestionRe: Updated NTFS.dll to 2.0memberFrEaK_CH21 Sep '06 - 5:10 
AnswerRe: Updated NTFS.dll to 2.0memberMoomansun21 Sep '06 - 7:59 
GeneralRe: Updated NTFS.dll to 2.0memberFrEaK_CH21 Sep '06 - 12:06 
GeneralRe: Updated NTFS.dll to 2.0memberFrEaK_CH25 Sep '06 - 12:03 
QuestionChanges in NTFS.dll? [modified]memberFrEaK_CH7 Jun '06 - 6:21 

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

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