|
-
June 7th, 2013, 06:24 PM
#1
Question about listing files with boost filesystem
Hi All,
I have the following code which is based of the tut3.cpp example at: http://www.boost.org/doc/libs/1_46_1...tory-iteration
However, I'm not entirely sure how to retrieve the full file path which I'd like to use to get the file size. So essentially the aim is to go through a directory and list all the file sizes. Any help would be greatly appriciated, thanks
Code:
if (exists(p)) {
if (is_directory(p)) {
cout << p << " is a directory containing:\n";
copy(directory_iterator(p), directory_iterator(), // directory_iterator::value_type
ostream_iterator<directory_entry>(cout, "\n")); // is directory_entry, which is
// path stream inserter
if (is_regular_file(p)) {
cout << p << " size is " << file_size(p) << '\n';
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|