Advertisement
TShiva

old_fag

Jun 8th, 2018
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.27 KB | None | 0 0
  1. #include <Windows.h>
  2. #include <vector>
  3.  
  4.  
  5. std::vector<std::string> get_all_files_names_within_folder(std::string& folder)
  6. {
  7.     std::vector<std::string> names;
  8.     std::string search_path = folder + "/*.*";
  9.     WIN32_FIND_DATA fd;
  10.     HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd);
  11.     if (hFind != INVALID_HANDLE_VALUE) {
  12.         do {
  13.             // read all (real) files in current folder
  14.             // , delete '!' read other 2 default folder . and ..
  15.             if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
  16.  
  17.                 names.push_back(fd.cFileName);
  18.             }
  19.         } while (::FindNextFile(hFind, &fd));
  20.         ::FindClose(hFind);
  21.     }
  22.     return names;
  23. }
  24.  
  25.  
  26.  
  27.  
  28. int main()
  29. {
  30.     std::string path = "X:\\Reversed Rooms\\Face Poker\\xgame-s\\out\\game1.zip";
  31.     std::vector<std::string> files = get_all_files_names_within_folder(path);
  32.     std::string new_name = "";
  33.     char* app_path = "java -jar X:\\Reversed Rooms\\Face Poker\\xgame-ss\\lua_output\\unluac.jar ";
  34.     for (auto it : files)
  35.     {
  36.         new_name = it + ".txt";
  37.         char* command_string = new char[strlen(app_path) + strlen(it.c_str()) + strlen(new_name.c_str()) + 4];
  38.         strcpy(command_string, app_path);
  39.         strcat(command_string, it.c_str());
  40.         strcat(command_string," > ");
  41.         strcat(command_string, new_name.c_str());
  42.         system(command_string);
  43.     }
  44.     system("PAUSE");
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement