Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Permissions Issue on Folder.copy

Status
Not open for further replies.

asmith555

Programmer
Oct 7, 2002
97
US
Here is the code:

const OVERWRITE = True
Const SRC_ROOT = "\\gso-s02\d$\InetPub\intranet\marketing_sales"
Const DEST_ROOT = "\\gso-s12\d$\Inetpub\intranet\marketing_sales"
wscript.timeout = 10000
set fso = createobject("Scripting.FileSystemObject")
set SrcFolder = fso.GetFolder(SRC_ROOT)
SrcFolder.Copy DEST_ROOT, OVERWRITE

When running I get a permission denied error on the "copy" line. I am running it as the domain admin so I don't think permissions should be an issue. There are also no read only files.

I can copy and paste the folder manually just fine.
 
Try this:

dim oFSO
Const OVERWRITE = True
Const SRC_ROOT = "\\gso-s02\d$\InetPub\intranet\marketing_sales"
Const DEST_ROOT = "\\gso-s12\d$\Inetpub\intranet\marketing_sales"
set oFSO=CreateObject("Scripting.FileSystemObject")
If oFSO.FolderExists(DEST_ROOT) Then
oFSO.CopyFolder SRC_ROOT, DEST_ROOT, OVERWRITE
End If


I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
You are welcome.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Hello all,

Just for the record for other readers, I do not see a difference the second script can do but the first cannot, or vice versa (apart from the existence of source folder and the use of off-topic .timeout etc.) .Copy can do as well as .copyfolder in case no multiple folder need copy.

regards - tsuji
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top