|
Home > Archive > dBASE Programming > October 2006 > Show progress of back Up
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Show progress of back Up
|
|
| John Noble 2006-10-25, 7:17 am |
| Using the following code:
// get paths to bde and back up directories
s = form.syscontrol1.rowset
s.first()
sourcePath = trim(s.fields["pathToBde"].value)
destPath = trim(s.fields["pathTobackup"].value)
try
fso = new oleautoclient("Scripting.FileSystemObject")
fso.CopyFolder(sourcePath,destPath)
// record date of back up
s.fields["datelastbackup"].value = date()
s.save()
msgbox("Back Up was successful.", "Back Up Complete", 16)
catch ( Exception e )
msgbox("Back Up was not successful. Please try again", "Error", 16)
endtry
During the actual backing up is there a way I can show the filenames within the directory that is being copied. It is so I can show the progress of the back up with a progress bar.
Thanks,
John
| |
|
| John,
I use the function below thanks to Rich at Autotracker. Just feed each file to the function and set up your progress bar to update before each file is copied.
HTH,
Rick
#Define COPY_FILE_OVERWRITE_IF_EXISTS false
#Define COPY_FILE_FAIL_IF_EXISTS true
FUNCTION zCopyFile(lpExistingFileName,lpNewFileNa
me,bFailIfExists)
/* Rich - www.autotraker.com
zCopyFile("c:\test32\moved.txt","c:\test\moved.txt",false)
Great for copying files such as log files that are in use.
this function will copy a file that is in use, where the
db2k copy file will return an error
bFailIfExists = Specifies how this operation is to proceed
if a file of the same name as that specified by lpNewFileName
already exists. If this parameter is TRUE and the new file
already exists, the function fails. If this parameter is FALSE
and the new file already exists, the function overwrites the
existing file and succeeds.
*/
* #Include Windef.h
* #Define COPY_FILE_OVERWRITE_IF_EXISTS false
* #Define COPY_FILE_FAIL_IF_EXISTS true
if ARGCOUNT() = 2
bFailIfExists = COPY_FILE_OVERWRITE_IF_EXISTS
endif
if type("CopyFileA") # "FP"
extern BOOL CopyFileA(;
LPCTSTR,; // lpExistingFileName, pointer to name of an existing file
LPCTSTR,; // lpNewFileName, pointer to filename to copy to
BOOL; // bFailIfExists, flag for operation if file exists
) kernel32 from "CopyFileA"
endif
return CopyFileA(lpExistingFileName,lpNewFileNa
me,bFailIfExists)
John Noble Wrote:
> Using the following code:
>
> // get paths to bde and back up directories
> s = form.syscontrol1.rowset
> s.first()
>
> sourcePath = trim(s.fields["pathToBde"].value)
> destPath = trim(s.fields["pathTobackup"].value)
>
> try
> fso = new oleautoclient("Scripting.FileSystemObject")
> fso.CopyFolder(sourcePath,destPath)
>
> // record date of back up
> s.fields["datelastbackup"].value = date()
> s.save()
> msgbox("Back Up was successful.", "Back Up Complete", 16)
>
> catch ( Exception e )
>
> msgbox("Back Up was not successful. Please try again", "Error", 16)
>
> endtry
>
>
> During the actual backing up is there a way I can show the filenames within the directory that is being copied. It is so I can show the progress of the back up with a progress bar.
>
> Thanks,
>
> John
>
|
|
|
|
|