How to quickly check if folder is empty (.NET)?

There is a new feature in Directory and DirectoryInfo in .NET 4 that allows them to return an IEnumerable instead of an array, and start returning results before reading all the directory contents. What’s New in the BCL in .NET 4 Beta 1 Directory.EnumerateFileSystemEntries method overloads public bool IsDirectoryEmpty(string path) { IEnumerable<string> items = Directory.EnumerateFileSystemEntries(path); … Read more

What is the difference between Directory.EnumerateFiles vs Directory.GetFiles?

From the docs: The EnumerateFiles and GetFiles methods differ as follows: When you use EnumerateFiles, you can start enumerating the collection of names before the whole collection is returned; when you use GetFiles, you must wait for the whole array of names to be returned before you can access the array. Therefore, when you are … Read more

What is the difference between a directory and a folder?

Check “The folder metaphor” section at Wikipedia. It states: There is a difference between a directory, which is a file system concept, and the graphical user interface metaphor that is used to represent it (a folder). For example, Microsoft Windows uses the concept of special folders to help present the contents of the computer to … Read more

How can I extract the folder path from file path in Python?

You were almost there with your use of the split function. You just needed to join the strings, like follows. >>> import os >>> ‘\\’.join(existGDBPath.split(‘\\’)[0:-1]) ‘T:\\Data\\DBDesign’ Although, I would recommend using the os.path.dirname function to do this, you just need to pass the string, and it’ll do the work for you. Since, you seem to … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)