Re: How to delete directory?
From: mscir (mscir_at_access4less.com.net.org.uk)
Date: 05/24/04
- Next message: How: "Run time error"
- Previous message: Steven Burn: "Re: How to delete directory?"
- In reply to: Ken: "How to delete directory?"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 24 May 2004 00:29:08 -0700
Ken wrote:
> Hi All,
> How to delete directory with VB6?
> Thanks in advance!
I know of two ways, one is straight VB:
From the help files:
RmDir Statement:
Removes an existing directory or folder.
Syntax:
RmDir path
The required path argument is a string expression that identifies the
directory or folder to be removed. The path may include the drive. If no
drive is specified, RmDir removes the directory or folder on the current
drive.
Remarks
An error occurs if you try to use RmDir on a directory or folder
containing files. Use the Kill statement to delete all files before
attempting to remove a directory or folder.
-------
Kill Statement Example:
This example uses the Kill statement to delete a file from a disk.
'Assume TESTFILE is a file containing some data.
Kill "TestFile" ' Delete file.
'Delete all *.TXT files in current directory.
Kill "*.TXT"
I think kill "path\*.*" deletes every file in the path.
Note: I think the files you kill can't be recovered from the recycle bin.
==================================
Or you can use the File System Object
(add a reference to Microsoft Scripting Runtime)
http://www.juicystudio.com/tutorial/vb/files.asp
Mike
- Next message: How: "Run time error"
- Previous message: Steven Burn: "Re: How to delete directory?"
- In reply to: Ken: "How to delete directory?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|