Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <boost/filesystem.hpp>
- #include <cstring>
- using namespace boost::filesystem
- int main()
- {
- bool recurse = true;
- string pathDest = "C:\\Users\\admin\\Desktop\\asdfasdf";
- // using namespace boost::filesystem;
- recursive_directory_iterator it("C:\\Users\\admin\\Desktop\\test"), end;
- for (; it != end; ++it)
- {
- int a = 0;
- if (!recurse)
- {
- it.no_push(); // disable recurse
- }
- if (!is_regular_file(*it))
- {
- continue;
- }
- // make the validity check
- auto filepath = it->path();
- if(filepath.extension() == ".bmp")
- {
- // rename(const path& old_p, const path& new_p);
- rename(filepath filepath.filename(), filepath a.tostring() );
- copy_file(filepath, pathDest);
- a++;
- }
- } // end for
- }
Add Comment
Please, Sign In to add comment