Re: permission denied when moving folder



For my method, you would have to move them one at a time, using the
full name of each (no wild cards). This does have the advantage of
allowing a rename if you don't want to overwrite a previously backed
up file. If you want to always overwrite, then use Pegasus' method.

-Paul Randall

"Lee Kok Onn" <kolee@xxxxxxxxxxxxxxxx> wrote in message
news:uydLPv9ZIHA.5792@xxxxxxxxxxxxxxxxxxxxxxx
i am using the following to delete file,

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFile "C:\data\*.*" , "\\server2\backup"

so how can I check for file existence with the line recommend by
you.


"Paul Randall" <paulr901@xxxxxxxxxxxx> wrote in message
news:%23JLazlzZIHA.4028@xxxxxxxxxxxxxxxxxxxxxxx

"Lee Kok Onn" <kolee@xxxxxxxxxxxxxxxx> wrote in message
news:O1UEvPxZIHA.4028@xxxxxxxxxxxxxxxxxxxxxxx
Thanks for the info.

I try to use movefile in the script and I need to overwrite the
same file everyday. But it prompt an error "file already exist".
So its there anyway that I can overwrite the file using movefile.

Why not, just before the move, check for the existence of the file
at the destination, and deleting it if necessary?

Something like:
If objFSO.FileExists(sDestinationPath) Then
objFSO.DeleteFile ( sDestinationPath[, force] )
End If

-Paul Randall




.



Relevant Pages

  • Re: permission denied when moving folder
    ... so how can I check for file existence with the line recommend by you. ... I try to use movefile in the script and I need to overwrite the same file everyday. ...
    (microsoft.public.scripting.wsh)
  • Re: permission denied when moving folder
    ... I try to use movefile in the script and I need to overwrite the same ... file everyday. ... But it prompt an error "file already exist". ...
    (microsoft.public.scripting.wsh)

Loading