Main Site Documentation

Copying a directory


Hello, I have managed to copy some files between thumb drives using the handy file.copy command. However, I cannot locate a copy command for a directory. Does anyone know if this exists?

I know I can write a routine that would scan through all the directories that would make the appropriate directories and individually copy the files, however, I am not a big fan of re-inventing the wheel if someone else has already put in the effort to make this routine.



Adapt as needed.


These is no copy only move. If you want to copy a directory and it’s contents you’ll need to write the recursive method yourself. Shouldn’t be too difficult though.


Thanks for the info, interesting that the algorithm you linked has some syntax I never knew existed

foreach (string s in files)

Learn something new every day! ;D


foreach’s are very slow, on an embedded system use a for loop.