Overwritten folder in FSO

Results 1 to 2 of 2

Thread: Overwritten folder in FSO

  1. #1
    Join Date
    Dec 1969

    Default Overwritten folder in FSO

    Can someone tell me how to overwritten a folder if this folder exists. I am using FSO to create the folder, here is the code, I tried to insert "true" right after the folder name but it didn&#039t take it. Here is an original code:<BR>Set fsoFolder = CreateObject("Scripting.FileSystemObject")<BR>Set fsoFolderName = fsoFolder.CreateFolder("c:\myfolder")<BR><BR>Is this the right syntax to overwritten a folder name?<BR>set fsoFolderName = fsoFolder.CreateFolder("c:\myfolder", true)<BR><BR>Thank you for you help.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Overwritten folder in FSO

    You can&#039t force the overwrite, the &#039true&#039 only works for files; the &#039overwrite&#039 property doesn&#039t exist for folders. You need to check if the folderexists and if true, delete it, then re-create it. <BR>For CreateFolder method:<BR>http://msdn.microsoft.com/scripting/vbscript/doc/vsmthcreatefolder.htm<BR><BR>For FolderExists:<BR>http://msdn.microsoft.com/scripting/vbscript/doc/vsmthfolderexists.htm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts