![]() To copy a folder's contents to a new location: String destFile = System.IO.Path.Combine(targetPath, fileName) String sourceFile = System.IO.Path.Combine(sourcePath, fileName) String sourcePath = targetPath = Use Path class to manipulate file and directory paths. C:\Users\Public\TestFolder\SubDir\test.txt To run this sample, first create the following directories and files: Simple synchronous file copy operations with no user interface. The following example shows how to copy files and directories. For information about how to perform these file operations asynchronously, see Asynchronous File I/O. Another approach is to use platform invoke to call the relevant file-related methods in the Windows Shell. Use System.IO.FileSystemWatcher to provide events that will enable you to calculate the progress when operating on multiple files. If you want to provide a standard progress dialog box, see How to provide a progress dialog box for file operations. ![]() These examples do not provide a progress bar or any other user interface. The following examples show how to copy, move, and delete files and folders in a synchronous manner by using the System.IO.File, System.IO.Directory, System.IO.FileInfo, and System.IO.DirectoryInfo classes from the System.IO namespace.
0 Comments
Leave a Reply. |