How to use to find files recursively?

There are a couple of ways: pathlib.Path().rglob() Use pathlib.Path().rglob() from the pathlib module, which was introduced in Python 3.5. from pathlib import Path for path in Path(‘src’).rglob(‘*.c’): print(path.name) glob.glob() If you don’t want to use pathlib, use glob.glob(): from glob import glob for filename in glob(‘src/**/*.c’, recursive=True): print(filename) For cases where matching files beginning with … Read more

How do I “normalize” a pathname using boost::filesystem?

Boost v1.48 and above You can use boost::filesystem::canonical: path canonical(const path& p, const path& base = current_path()); path canonical(const path& p, system::error_code& ec); path canonical(const path& p, const path& base, system::error_code& ec); http://www.boost.org/doc/libs/1_48_0/libs/filesystem/v3/doc/reference.html#canonical v1.48 and above also provide the boost::filesystem::read_symlink function for resolving symbolic links. Boost versions prior to v1.48 As mentioned in other answers, … Read more

Atomicity of File.Move

Yes, in NTFS. From here: As an aside if you are running under NTFS then file operations are atomic at the file system level. A rename will occur in a single operation as far as any higher code is concerned. The problem you are seeing almost appears to be an issue where the FileInfo object … Read more

How can I invalidate the file system cache?

At least on Windows 7, it seems that attempting to open a volume handle without FILE_SHARE_WRITE sharing permissions causes the file system cache to be invalidated, even if the creation fails. Thus I made a program that simply calls CreateFile to this end. Download the program* from its Base64 version here: <!– Click “Run Snippet”, … Read more