After spend a whole afternoon testing code in this article( they didn't work), I found this in msdn:
All methods of the Directory class are static and can therefore be called without having an instance of a directory. The DirectoryInfo class contains only instance methods. The static methods of the Directory class perform a security check on all methods. If you are going to reuse an object several times, consider using the corresponding instance method of DirectoryInfo instead, because the security check will not always be necessary.
You need to replace all "File" with "FileInfo" and "Directory" with "DirectoryInfo" in this article!!!