Backing up folders/files

Blitz3D Forums/Blitz3D Programming/Backing up folders/files

Farflame(Posted 2007) [#1]
I want to write a routine to backup my game folder. So far I can only see the Copyfile command which copies files only. Is there a way to copy an entire folder and it's contents in Blitz?


puki(Posted 2007) [#2]
Don't think so.

However, you can Create a folder - so, technically, you can do it by creating the copy directory (naming it to whatever you want) first then copy the files into it.


GfK(Posted 2007) [#3]
Recursive file copy.

i.e.
Function FileCopy()
  Repeat
    Is filetype a file, or folder?
    If file, copy file
    If folder, update path and call FileCopy()
  Until no more files/subfolders in folder
End Function



Farflame(Posted 2007) [#4]
Thanks. I tried it and got a bit stuck, but then I found a sample in the archives which does exactly as you suggested..... it's at http://www.blitzbasic.com/codearcs/codearcs.php?code=677