Guest User

Untitled

a guest
Jan 21st, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.82 KB | None | 0 0
  1.  
  2. #include <boost/filesystem.hpp>
  3. #include <cstring>
  4. using namespace boost::filesystem
  5. int main()
  6. {
  7.     bool recurse = true;
  8.     string pathDest = "C:\\Users\\admin\\Desktop\\asdfasdf";
  9.  
  10.     // using namespace boost::filesystem;
  11.     recursive_directory_iterator it("C:\\Users\\admin\\Desktop\\test"), end;
  12.     for (; it != end; ++it)
  13.     {
  14.         int a = 0;
  15.         if (!recurse)
  16.         {
  17.             it.no_push(); // disable recurse
  18.         }
  19.         if (!is_regular_file(*it))
  20.         {
  21.             continue;
  22.         }  
  23.         // make the validity check
  24.         auto filepath = it->path();
  25.        
  26.         if(filepath.extension() == ".bmp")
  27.         {
  28.            // rename(const path& old_p, const path& new_p);
  29.             rename(filepath filepath.filename(), filepath a.tostring() );
  30.             copy_file(filepath, pathDest);
  31.             a++;
  32.          
  33.         }
  34.        
  35.        
  36.     } // end for
  37. }
Add Comment
Please, Sign In to add comment