Find a file within all possible folders?

This code fragment retrieves a list of all logical drives on the machine and then searches all folders on the drive for files that match the filename “Cheese.exe”. Once the loop has completed, the List “files” contains the var files = new List<string>(); //@Stan R. suggested an improvement to handle floppy drives… //foreach (DriveInfo d … Read more

Java : File.exists() inconsistencies when setting “user.dir”

Setting user.dir is unsupported. It should be considered a read-only property. For example the evaluation of Bug 4117557 in the Sun Bug Parade contains this text: “user.dir”, which is initialized during jvm startup, should be used as an informative/readonly system property, try to customize it via command line -Duser.dir=xyz will end up at implementation dependend/unspecified … Read more

Unicode encoding for filesystem in Mac OS X not correct in Python?

MacOS X uses a special kind of decomposed UTF-8 to store filenames. If you need to e.g. read in filenames and write them to a “normal” UTF-8 file, you must normalize them : filename = unicodedata.normalize(‘NFC’, unicode(filename, ‘utf-8’)).encode(‘utf-8’) from here: https://web.archive.org/web/20120423075412/http://boodebr.org/main/python/all-about-python-and-unicode

Different utf8 encoding in filenames os x

(This is mostly stolen from a previous answer of mine…) Unicode allows some accented characters to be represented in several different ways: as a “code point” representing the accented character, or as a series of code points representing the unaccented version of the character, followed by the accent(s). For example, “รค” could be represented either … Read more