Urgent: Delete folder

Hi All,

I m wokring on Lotus Notes R6.0. I have a folder like “C:\Test” in this folder i have 10 file with the extension of .doc,.txt,.jpg etc. I want to delete the folder Test with file contains thr lotusscript code. So how to do this?

Thx in Advance,

Santosh

Subject: Urgent: Delete folder

Hi Andre,

I m wokring on Lotus Notes R6.0. I have a folder like “C:\Test” in this folder i have 10 file with the extension of .doc,.txt,.jpg etc. I want to delete the folder Test with file contains thr lotusscript code. So how to do this?

Actually i have written a code in lotusscript what i m doing wrong in code?

Sub Initialize

Dim fileName As String

Dim pathName As String

pathName$ = "C:\Test\*.*"

fileName$ = Dir$(pathName$, 0)



Do While fileName$ <> ""

	Print "<BR>"

	Print fileName$

	fileName$ = Dir$()

	Kill fileName$

	Rmdir "C:\Test"

Loop

End Sub

Thx in Advance,

Santosh.

Subject: RE: Urgent: Delete folder

What am I doing wrong?

You forgot to say what the code is doing instead of working.

You forgot to say in what context the code is running. Since you’re printing
I assume this is a web application, but I don’t know whether it’s a Webquerysave agent or what.

You didn’t use Option Declare

You didn’t use On Error to trap and deal with any errors that occurred during the run – you need to at least print a sensible error message rather than just letting the agent abort.

You’re reading the next filename before you delete the first file, so the first file will never be deleted.

You’re trying to delete the file without first checking the just-read filename to see whether it is blank.

You’re trying to remove the folder while still inside the loop, which will cause an error since the folder is not yet empty.

The ID that signed the agent is not authorized to run unrestricted agents.

The agent itself is not set to allow unrestricted operations.

Subject: RE: Urgent: Delete folder

Use Dir$ to find out what files are in the folder, Kill to remove them, and Rmdir to remove the directory once it’s empty.