Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to delete a folder

532 views
Skip to first unread message

George Akers

unread,
May 24, 2001, 9:18:09 AM5/24/01
to
I'm using PB7.03 and I am wondering how I would go about deleting a
folder(directory) and all its contents.

Chris

unread,
May 24, 2001, 9:31:44 AM5/24/01
to
I'm not sure about the actual directory but you could do a DirList to get
the contents of the directory in a listbox. Then you could loop through the
listbox and do a FileDelete on the files.

As far as the directory I guess you could call a batch file that actually
did the delete.

Good luck,

Chris
"George Akers" <ake...@dot.state.al.us> wrote in message
news:3B0D0A11...@dot.state.al.us...

George Akers

unread,
May 24, 2001, 11:17:29 AM5/24/01
to
Thanks. I'm able to delete the files alright, it's the directory that has really
got me stuck. The bat file option could be implemented but I was wondering if
there was something in Powerscript that would do it.

Bug

unread,
May 24, 2001, 1:09:03 PM5/24/01
to
Check the pfc code for the API for this.

"George Akers" <ake...@dot.state.al.us> wrote in message

news:3B0D2609...@dot.state.al.us...

Dan Thibodeaux

unread,
May 24, 2001, 1:37:58 PM5/24/01
to
Use the Windows 32-Bit API Function call DeleteFileA( )

See this link http://my.sybase.com/detail?id=44545

DeleteFileA( )
This function receives a string by reference containing a fully path
qualified filename and deletes that file. There is no PowerBuilder
equivalent.

Global External Function:
FUNCTION boolean DeleteFileA(ref string filename) LIBRARY "Kernel32.dll"

Script:
string l_file
boolean rtn
l_file = string(sle_to.text)
rtn = DeleteFileA(l_file)
MessageBox("DeleteFile", string(rtn))


"George Akers" <ake...@dot.state.al.us> wrote in message
news:3B0D0A11...@dot.state.al.us...

Philip Salgannik

unread,
May 24, 2001, 3:09:21 PM5/24/01
to
To do this properly you need a combination of 2 things:

1) Delete all the files in the target directory - you can do this in the
ways described to in other replies (for e.g. get the file listing and then
delete them one by one), or do it using SHFileOperationA API (see Roy
Kiesler's PFC Shell Service
http://teamsybase.com/roy.kiesler/downloads/shell.zip)

2) After the directory is empty, use RemoveDirectoryA API (see PFC Win32
file service)


This is a FAQ, read Help, then search www.groups.google.com

pbm_thisusuallydoesnothelp:-))
Philip Salgannik

"George Akers" <ake...@dot.state.al.us> wrote in message
news:3B0D0A11...@dot.state.al.us...

0 new messages