Click to See Complete Forum and Search --> : FileSystemObject Error


Cubbie
March 21st, 2001, 09:31 AM
I am trying to use the FileSystemObject to back up a user's profile to the d:\ drive on a partitioned hard drive. I keep getting a permission denied error when trying to write over the current folder. I can't even delete the folder and create it again without getting this error. I've tried numerous combination of Copy, CopyFolder etc. with the same results Any suggestions???

on error resume next

Screen.MousePointer = vbHourglass
DoEvents

Call GetUser 'to get UserId
DoEvents
'*******************Profile Backup**************************
Dim fso as new FileSystemObject
Dim fs as Folder
Dim sPath as string

set fso = new FileSystemObject
sPath = "c:\winnt\profiles\" & UserId & "\Application Data"

If fso.FolderExists then fso.DeleteFolder ("d:\Profile Backup") 'error permission denied
If Not fso.FolderExits then fso.CreateFolder ("d:\Profile Backup")
If Not fso.FolderExists then fso.CreateFolder ("d:\Profile Backup\Application Data")
fso.CopyFolder sPath, "d:\Profile Backup\Application Data" 'error Permission denied

set fso = nothing
set fs = nothing