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.
To copy items to a folder, the following steps must be performed:
Retrieve a reference to a folder using an AbstractFolder-derived class appropriate for the folder you need to work with, such as DiskFolder, ZippedFolder, ZipArchive, MemoryFolder, IsolatedFolder, FtpFolder, etc.
Call the CopyFilesTo method to copy the files from the source folder (including subfolders that contain files) to the destination folder.
This example demonstrates how to copy files from one disk folder to another.
VB.NET | Copy Code |
---|---|
|
C# | Copy Code |
---|---|
|
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.