How do databases physically store data on a filesystem?

The answer to this question is both database dependent and implementation dependent. Here are some examples of how data can be stored: As a single file per database. (This is the default for SQL Server.) Using a separate file system manager, which could be the operating system. (MySQL has several options, with names like InnoDB.) … Read more

Best distributed filesystem for commodity linux storage farm [closed]

check also GlusterFS Edit (Aug-2012): Ceph is finally getting ready. Recently the authors formed Inktank, an independent company to sell commercial support for it. According to some presentaions, the mountable POSIX-compliant filesystem is the uppermost layer and not really tested yet, but the lower layers are being used in production for some time now. The … Read more

How to copy a directory and its contents to an existing location using Python?

distutils.dir_util.copy_tree does what you want. Copy an entire directory tree src to a new location dst. Both src and dst must be directory names. If src is not a directory, raise DistutilsFileError. If dst does not exist, it is created with mkpath(). The end result of the copy is that every file in src is … 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

C#: What is the fastest way to generate a unique filename?

A GUID would be extremely fast, since it’s implementation guarantees Windows can generate at least 16,384 GUIDS in a 100-nanosecond timespan. (As others pointed out, the spec doesn’t guarantee, only allows for. However, GUID generation is really, really fast. Really.) The likelihood of collision on any filesystem anywhere on any network is very low. It’s … Read more

boost::filesystem get relative path

In new versions of boost (starting in 1.60), you can use boost::filesystem::relative. (See the documentation here.) #include <boost/filesystem.hpp> #include <iostream> namespace fs = boost::filesystem; int main() { fs::path parentPath(“/home/user1/”); fs::path childPath(“/home/user1/Downloads/Books”); fs::path relativePath = fs::relative(childPath, parentPath); std::cout << relativePath << std::endl; }