Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Whats wrong with this code?


Message #1 by Arundhati Bopardikar <Bopardikar@Q...> on Tue, 30 Jul 2002 08:47:12 -0700
Hi,

I am trying to delete a folder using ASP filesystemobject with something
like the
following code

	dim Readstr
	dim fldr 
	dim fp 
	dim FilePath 

	FilePath = "C:\Folder1\Abc.txt" 
	Readstr = Split(FilePath,"\")

	fldr = Readstr(0) & "\" & Readstr(1) 

	set fp = Server.CreateObject("Scripting.FileSystemObject") 

	If fp.FolderExists(fldr) Then 
		
		fp.DeleteFile fldr 
	End If 

	set fp = nothing 



However, the script just hangs and does nothing...
can anyone help??

Regards,
Arundhati
Message #2 by "Roy, Siddarth S" <sroy@b...> on Tue, 30 Jul 2002 11:57:56 -0400
Is nt that supposed to delete folder rather than delete file

Hope this helps
thx
sid

-----Original Message-----
From: Arundhati Bopardikar [mailto:Bopardikar@Q...]
Sent: Tuesday, July 30, 2002 11:47 AM
To: ASP Databases
Subject: [asp_databases] Whats wrong with this code?


Hi,

I am trying to delete a folder using ASP filesystemobject with something
like the
following code

	dim Readstr
	dim fldr
	dim fp
	dim FilePath

	FilePath =3D "C:\Folder1\Abc.txt"
	Readstr =3D Split(FilePath,"\")

	fldr =3D Readstr(0) & "\" & Readstr(1)

	set fp =3D Server.CreateObject("Scripting.FileSystemObject")

	If fp.FolderExists(fldr) Then
	=09
		fp.DeleteFile fldr
	End If

	set fp =3D nothing



However, the script just hangs and does nothing...
can anyone help??

Regards,
Arundhati

Message #3 by "Kim Iwan Hansen" <kimiwan@k...> on Tue, 30 Jul 2002 18:07:15 +0200
Are you running any antivirus software by any chance, e.g. NAV ?  Make sure
you disable script protection.

-Kim

> -----Original Message-----
> From: Arundhati Bopardikar [mailto:Bopardikar@Q...]
> Sent: 30. juli 2002 17:47
> To: ASP Databases
> Subject: [asp_databases] Whats wrong with this code?
>
>
> Hi,
>
> I am trying to delete a folder using ASP filesystemobject with something
> like the
> following code
>
> 	dim Readstr
> 	dim fldr
> 	dim fp
> 	dim FilePath
>
> 	FilePath = "C:\Folder1\Abc.txt"
> 	Readstr = Split(FilePath,"\")
>
> 	fldr = Readstr(0) & "\" & Readstr(1)
>
> 	set fp = Server.CreateObject("Scripting.FileSystemObject")
>
> 	If fp.FolderExists(fldr) Then
>
> 		fp.DeleteFile fldr
> 	End If
>
> 	set fp = nothing
>
>
>
> However, the script just hangs and does nothing...
> can anyone help??
>
> Regards,
> Arundhati
>

Message #4 by "Drew, Ron" <RDrew@B...> on Tue, 30 Jul 2002 12:49:44 -0400
permissions are an important issue. The IUSR_machinename user ID must
have write permissions. Deletes items in directory before deleting
directory.

Dim objFSO
Set objFSO =3D Server.CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile "C:\Folder1\*.*", False
objFSO.DeleteFile "C:\Folder1", False
Set objFSO =3D Nothing

The optional parameter for the DeleteFile method is Force.
False (default) will not delete read-only files.
True will delete read-only files.

-----Original Message-----
From: Arundhati Bopardikar [mailto:Bopardikar@Q...]
Sent: Tuesday, July 30, 2002 11:47 AM
To: ASP Databases
Subject: [asp_databases] Whats wrong with this code?


Hi,

I am trying to delete a folder using ASP filesystemobject with something
like the following code

	dim Readstr
	dim fldr
	dim fp
	dim FilePath

	FilePath =3D "C:\Folder1\Abc.txt"
	Readstr =3D Split(FilePath,"\")

	fldr =3D Readstr(0) & "\" & Readstr(1)

	set fp =3D Server.CreateObject("Scripting.FileSystemObject")

	If fp.FolderExists(fldr) Then
	=09
		fp.DeleteFile fldr
	End If

	set fp =3D nothing



However, the script just hangs and does nothing...
can anyone help??

Regards,
Arundhati


  Return to Index