#include #include #include #include #include #include using namespace std; string iPut; /********************************************************************************/ vector split(const string& str, const string& delimiters) { vector tokens; string::size_type lastpos = str.find_first_not_of(delimiters, 0); string::size_type pos = str.find_first_of(delimiters, lastpos); while (string::npos != pos || string::npos != lastpos) { tokens.push_back(str.substr(lastpos, pos - lastpos)); lastpos = str.find_first_not_of(delimiters, pos); pos = str.find_first_of(delimiters, lastpos); } return tokens; } /********************************************************************************/ int main(int argc,char **argv) { ifstream inFile; int i=0; if(argc!=5) { cout << "** Error\n" << argv[0] << " robocopy.exe \"\\\\nassy1\" \"\\\\nas02\"\n";fflush(stdout); exit(0); } inFile.open(argv[2]); if(!inFile) { cout << "Issue Opening " << argv[2] << "\n"; exit(0); } while(getline(inFile,iPut)) { stringstream oPut; string Path; oPut< result=split(Path,"\\"); Path.clear(); for(i=0;i<(int)result.size()-1;i++) { Path+="\\"; Path+=result[i]; } oPut.str(""); oPut.clear(); oPut << argv[1] << " \"" << argv[3] << Path << "\" \"" << argv[4] << Path<< "\" \"" << result[(int )result.size()-1] <<"\""; string cmd=oPut.str(); cout << cmd << "\n"; system(cmd.c_str()); iPut=""; } inFile.close(); }