| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Copying complete Folders in C++!
Hey,
Pleas can anyone help me with this problem. I know the regular copy function: system("copy file file"); but how to copy a complete folder (with this function it wont work) thx a lot, Adriaan |
|
#2
|
|||
|
|||
|
if youre looking to do a system call for it, use the command xcopy. there is a switch to make it not ask if it is a folder or a file. xcopy /? for help. windows only, though
|
|
#3
|
||||
|
||||
|
'xcopy /e' copies entire directories, recursively.
On linux, use 'cp -R' PS: sorry for necromancing... ![]()
__________________
This is my code. Is it not nifty? "The biggest problem encountered while trying to design a system that was completely foolproof, was, that people tended to underestimate the ingenuity of complete fools." ---Douglas Adams Join the Itsacon fanclub! Zero Tolerance: Spammers banned so far: 275
![]() |
|
#4
|
||||
|
||||
|
System() (which is not the definition of a system call!) only returns the return value of that shell command. If you want to have more control you could write your own copier (just with opening, reading and writing files).
For windows there is a copy function CopyFile (which is of course a system call..) you can use, example: http://www.geocities.com/rodolfofrino/CopySubdirectory.html To 'browse' a directory you can use opendir/readdir for linux and findNextfile for windows (this is also in the example). An alternative for linux is using glob(). With these functions you can have more control and do better error checking and feedback. But it is a lot more work ![]() |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > Copying complete Folders in C++! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|