views:

128

answers:

1

Hi all,

I am looking for standard libraries in C++ that would allow me to do things like:

  1. Traverse a directory recursively
  2. search for files within a directory
  3. Check if file exists, folder exists or not and create it if not present.
  4. Check a folder hierarchy exists or create it if not found. Equivalent of mkdir -p
  5. Uncompressing / Compressing a file
  6. Checking the CRC / Hash of the file
  7. copy file, delete file, delete folder, copy folder recursively
  8. running a system command and reading its console output within the program.

It seems that scripting languages and Java have good support for these kind of problems. But, I am not able to find out there are standard ways of doing this in C++.

Thanks!
Ajay

+7  A: 

No, but if you want a good library implementation, you might look into Boost.Filesystem; it has widely used, cross-platform facilities for doing most of those things.

James McNellis
I have heard about this one, but then I will have to install the entire Boost library , which is HUGE , just for this one thing. Isn't it? Or is there a way to install only the required things from Boost?
ajay
Are you worried about the free space on your hard drive, or something else? (HD space is cheap.) Just because you use one header from boost doesn't mean your final program has to know or care about the rest. Many of the boost libraries are header-only and those are as easy to use as a single #include.
Roger Pate
I've never tried using just a part of Boost, but you only need to have the libraries on the computer on which you develop. You don't have to distribute the entire package with your application. The Boost libraries don't add much to the size of your actual binaries since only what you use gets pulled in when you build.
James McNellis
Boost.Filesystem is not header only, so you will need to compile this library. But it is a very useful one!
pythonic metaphor
Boost is well worth the download - even if you can't use it for some reason (maybe your team is concerned about the dependency), Boost is a *great* resource for learning.
Michael Burr