Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <vector>
- std::vector<std::string> get_all_files_names_within_folder(std::string& folder)
- {
- std::vector<std::string> names;
- std::string search_path = folder + "/*.*";
- WIN32_FIND_DATA fd;
- HANDLE hFind = ::FindFirstFile(search_path.c_str(), &fd);
- if (hFind != INVALID_HANDLE_VALUE) {
- do {
- // read all (real) files in current folder
- // , delete '!' read other 2 default folder . and ..
- if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
- names.push_back(fd.cFileName);
- }
- } while (::FindNextFile(hFind, &fd));
- ::FindClose(hFind);
- }
- return names;
- }
- int main()
- {
- std::string path = "X:\\Reversed Rooms\\Face Poker\\xgame-s\\out\\game1.zip";
- std::vector<std::string> files = get_all_files_names_within_folder(path);
- std::string new_name = "";
- char* app_path = "java -jar X:\\Reversed Rooms\\Face Poker\\xgame-ss\\lua_output\\unluac.jar ";
- for (auto it : files)
- {
- new_name = it + ".txt";
- char* command_string = new char[strlen(app_path) + strlen(it.c_str()) + strlen(new_name.c_str()) + 4];
- strcpy(command_string, app_path);
- strcat(command_string, it.c_str());
- strcat(command_string," > ");
- strcat(command_string, new_name.c_str());
- system(command_string);
- }
- system("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement