-
May 13th, 2009, 06:38 AM
#1
Creating necessary directories?
Hello!
I have this code:
Code:
nub = "copy HldsUpdateTool.exe \"";
nub7 = "\\";
nub6 = nub7 += dir;
nub4 = "\"";
nub2 = nub += dir;
nub5 = nub4 += nub6;
lastquote = "\\\"";
nesdir = "mkdir";
nesdir1 = dir;
nesdir2 = nesdir1 += nesdir;
// Create a batch script and insert some text.
ofstream myfile;
myfile.open ("copying.bat");
myfile << ":: This is an automaticly created batchscript\n";
myfile << ":: This will only copy your HldsUpdateTool.exe to your selected folder.\n";
myfile << ":: And your srcds folder\n";
myfile << "set olddir=%cd%\n";
myfile << "cd \"%olddir%\"\n";
myfile << nub;
myfile << lastquote;
myfile.close();
The batch script looks like:
(If I sat dir to C:/SERVER\.
Code:
:: This is an automaticly created batchscript
:: This will only copy your HldsUpdateTool.exe to your selected folder.
:: And your srcds folder
set olddir=%cd%
cd "%olddir%"
copy HldsUpdateTool.exe "c:/SERVER\"
However the problem is that I want to create that dir. Also if it were like:
C:/SERVER/SRCDS/1123/
It should create all those directories for me. Since it can't copy that file before the dir exits.
-
May 13th, 2009, 07:44 AM
#2
Re: Creating necessary directories?
Seems like a bit of a hassle just to copy a file. Have a look at boost::filesystem for a platform independent implementation or at CopyFile for Windows.
Cheers, D Drmmr
Please put [code][/code] tags around your code to preserve indentation and make it more readable.
As long as man ascribes to himself what is merely a posibility, he will not work for the attainment of it. - P. D. Ouspensky
-
May 13th, 2009, 07:57 AM
#3
Re: Creating necessary directories?
I don´t see how this is related to C++.
Use xcopy instead of copy and you´re done.
- Guido
-
May 13th, 2009, 10:16 AM
#4
Re: Creating necessary directories?
Originally Posted by GNiewerth
I don´t see how this is related to C++.
Use xcopy instead of copy and you´re done.
Works! Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|