Re: Bgt question

Do you want it to be recursive, and can you proof it against people copying a directory into itself and causing it to replicate until you run out of disc space?
You can probably get away with directory_create, then use a for loop to copy the files. Unless file_copy takes wildcards, in which case file_copy(dir + "\\*", newdir + "\\*")... but I think you need the loop.
To make it recursive, you'd need a function that calls itself for every subdirectory. Again, with something like that, it must be able to avoid copying to itself, otherwise it will not stop until you run out of space, and maybe not even then, if it just ignores errors and keeps trying.

Ex:
void deepcopy (string head, string dest) {
    string[] dirs = find_directories(head + "\\*");
    for (uint j = 0; j < dirs.length(); j++) deepcopy(head + "\\" + dirs[j], dest + "\\" + dirs[j]);
    string[] files = find_files(head + "\\*");
    for (uint j = 0; j<files.length(); j++) file_copy(head + "\\" + files[j], dest + "\\" + files[j]);
}
Disclaimer: not tested, not infinite-proof.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : cmerry via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Liam via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : cmerry via Audiogames-reflector

Reply via email to