Click here to Skip to main content
6,596,602 members and growing! (22,390 online)
Email Password   helpLost your password?
Desktop Development » Files and Folders » Security     Intermediate

Find and delete NTFS Alternate Data Streams (ADS )

By Marco Roello

A GUI extension of the NTFS library written by Richard Deeming.
C#, .NET, Win2K, WinXPVS.NET2003, Dev
Posted:19 Oct 2005
Views:32,224
Bookmarked:19 times
Announcements
Loading...
 
Search    
Advanced Search
Add to IE Search
printPrint   add Share
      Discuss Discuss   Broken Article?Report  
2 votes for this article.
Popularity: 1.26 Rating: 4.20 out of 5

1

2

3
1 vote, 50.0%
4
1 vote, 50.0%
5

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


Member

Occupation: Web Developer
Location: Italy Italy

Other popular Files and Folders articles:

Article Top
You must Sign In to use this message board.
FAQ FAQ 
 
Noise Tolerance  Layout  Per page   
 Msgs 1 to 7 of 7 (Total in Forum: 7) (Refresh)FirstPrevNext
GeneralADS on Directories PinmemberDave Nelson9:12 12 Oct '06  
GeneralUpdated NTFS.dll to 2.0 PinmemberMoomansun14:57 23 Aug '06  
QuestionRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH6:10 21 Sep '06  
AnswerRe: Updated NTFS.dll to 2.0 PinmemberMoomansun8:59 21 Sep '06  
GeneralRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH13:06 21 Sep '06  
GeneralRe: Updated NTFS.dll to 2.0 PinmemberFrEaK_CH13:03 25 Sep '06  
QuestionChanges in NTFS.dll? [modified] PinmemberFrEaK_CH7:21 7 Jun '06  

General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

PermaLink | Privacy | Terms of Use
Last Updated: 19 Oct 2005
Editor: Smitha Vijayan
Copyright 2005 by Marco Roello
Everything else Copyright © CodeProject, 1999-2009
Web16 | Advertise on the Code Project