Xceed .NET Libraries Documentation
Welcome to Xceed Data Manipulation Compoents for .NET and .NET Standard / Basic Concepts / Xceed's FileSystem Core / Copying items to a folder

In This Topic
    Copying items to a folder
    In This Topic

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

    Basic steps

    To copy items to a folder, the following steps must be performed:

    Demonstration

    This example demonstrates how to copy files from one disk folder to another.

    VB.NET Copy Code

    Imports Xceed.FileSystem 

    Dim diskFolder As New DiskFolder( "c:\temp" )
    diskFolder.CopyFilesTo( New DiskFolder( "c:\destination" ), True, True )

    C# Copy Code

    using Xceed.FileSystem;

    DiskFolder diskFolder = new DiskFolder( @"c:\temp" );
    diskFolder.CopyFilesTo( new DiskFolder( @"c:\destination" ), true, true );

    Things you should consider

    The main questions you should ask yourself when copying the contents of a folder are:

    • Do you want to filter (specify specific files and folders) the items that are to be copied? Use filters

    • Do you want to display the status of the operation? See the Events topic. 

    • Do you also want to copy the folder? Use the CopyTo method instead of the CopyFilesTo method. 

    • Do you only want to copy a specific file or folder? Use the CopyTo method. 

    • Do you want to move items rather than copy them? Use the MoveTo and MoveFilesTo methods.