Xceed .NET Libraries Documentation
Removing items from a folder

Welcome to Xceed .NET, .NET Standard and Xamarin Libraries! > Basic Concepts > Xceed's FileSystem Core > Removing items from a folder

This topic demonstrates how to remove items from a folder by retrieving a reference to a file. With Xceed's FileSystem-based products, a file is a file: it does not matter if it is located within a zip file, on disk or in memory.

Basic steps

To remove items from a folder, the following steps must be performed:

Demonstration

This example demonstrates how to remove a file from within a folder located on disk.

VB.NET Copy Code

Imports Xceed.FileSystem

Dim f As New DiskFile( "c:\test.txt" ) 

If f.Exists Then
  f.Delete()
End If

C# Copy Code

using Xceed.FileSystem;

DiskFile f = new DiskFile( @"c:\test.txt" ); 

if ( f.Exists )
{
  f.Delete();
}

Things you should consider

The main questions you should ask yourself when removing items from a folder are: