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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Client-side script to test for folder

Status
Not open for further replies.

furtivevole

Technical User
Jun 21, 2001
84
GB
Hi

When a certain .asp page is opened, I need to check if a specific client-side folder already exists, and then ask the user whether it (and its contents) should be deleted or remain.

Intranet application, all users have IE, mainly W2K.
Error is: ActiveX component can't create object.

Can someone advise please?

[tt]<script language=&quot;vbscript&quot;>
sub window_onload
dim ProdFolder, msg, sys, fol, foldate, rtnval
ProdFolder = &quot;C:\hardcoded_path&quot;
set sys = CreateObject( &quot;Scripting.FileSystemObject&quot; )

if sys.FolderExists( ProdFolder ) Then
set fol = sys.GetFolder( ProdFolder )
foldate = fol.DateCreated
msg = &quot;The destination folder already exists. It was created on &quot; & foldate
msg = msg + chr(10) & &quot;Would you like me to delete it now? &quot;
rtnval = msgbox(msg, 52, ProdFolder)
if rtnval = vbYes then
sys.DeleteFolder (ProdFolder)
rtnval = msgbox(&quot;Folder deleted!&quot;,48,ProdFolder)
else
rtnval = msgbox(&quot;Previous folder remains on local drive&quot;,48,ProdFolder)
end if
end if
set sys=nothing
set ProdFolder=nothing
end sub
</script>[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top