C# Edge 82 – C# Copy a Directory

7
6



has all my video tutorials usually with source code in an organized cyber-library. In this video we learn how to copy an entire directory using C# code. Extensive use is made of the C# debugger: breakpoints, watchpoints, Step Over, Step Into, Step out of, and so on.

Nguồn:https://wijstaanvooronzegrondrechten.org/

7 COMMENTS

  1. It sounds like you want to keep multiple versions of the same files as they existed in the past. The solution the old Vax operating system had for this idea was to append version numbers to the files (or the equivalent). So fred.txt became fred.txt.001, fred.txt.002, etc. Just read in the version number (i.e. with a string split), covert it to integer, increment it by 1 and re-append it to the previous version (as your showing with .old).

    There other solutions, of course, i.e multiple dirs

  2. what to do if you want to copy over and over again the same files? i cant fint a solution, it must be something like this right? if ( File.Exists( path ) )
    File.Move( path, path + ".old" ); thx for help

  3. Hi cyborgmagus,
    I add a new file to the source folder, how to copy the new file to the destination folder?
    it is for backup purpose.
    Thanks

LEAVE A REPLY

Please enter your comment!
Please enter your name here