Computer Science Canada

How Do You Delete A Folder?

Author:  Fiend-Master [ Sun Jan 16, 2005 1:12 am ]
Post subject:  How Do You Delete A Folder?

Ok, I got my program to delete a file of my choice on any given location on my computer, assuming of course i enter the correct pathname. When i tried to use the same code to delete a folder, I got an error msg "Access (permission) denied"

% The "File.Delete" program.
const pathName : string := "C:\\WINDOWS\\Desktop\\Test"

% Create file
var f : int
var line : string
open : f, pathName, put
put : f, "There is a line here"
close : f
put pathName, " created"

% Delete the file
File.Delete (pathName)
if Error.Last = eNoError then
put skip, pathName, " deleted"
else
put skip, "Did not delete ", pathName
put "Error: ", Error.LastMsg
end if

Thats the code I used (the code is an altered version of the example in the help section) (its supposed to delete a folder named "Test" on my desktop). Is there any hope? Thanks in advance.

Author:  Delos [ Sun Jan 16, 2005 9:58 am ]
Post subject: 

1)
Use [code] or [syntax] tags.

2)
Press F10.

3)
Search for Dir. commands.


: