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

How to delete all files and subfolders within a directory?

1,079 views
Skip to first unread message

Dominic

unread,
Mar 8, 2000, 3:00:00 AM3/8/00
to
hi,
Is there an Api function that works similar to the "deltree" command in
dos? i tried the DeleteFile function but it only deletes one file at a time
and i tried the RemoveDirectory function but it only works for empty
directory. Any Idea?

Dominic

Bruce Armstrong [TeamSybase]

unread,
Mar 8, 2000, 3:00:00 AM3/8/00
to
You could use the FileFileFirst and then the FileFindNext and DeleteFile
functions in a loop to delete all the files.

Also, older versions of SHFileOperation would take a wildcard, but MS has
decided to tighten the syntax in newer versions to prevent that:

http://msdn.microsoft.com/library/psdk/shellcc/shell/Functions/SHFileOperation.h
tm

On Wed, 8 Mar 2000 13:46:15 -0500,
in powersoft.public.powerbuilder.general

---
Bruce Armstrong [TeamSybase]
mailto:Bruce.A...@teamsybase.com

Preach the gospel at all times. If necessary, use words. [Francis of Assisi]
http://www.kidbrothers.org | http://www.fccwc.org
http://www.harvest.org/knowgod/index.htm | http://www.needhim.org

-----------== Posted via the PFCGuide Web Newsreader ==----------
http://www.pfcguide.com/_newsgroups/group_list.asp

Dominic

unread,
Mar 8, 2000, 3:00:00 AM3/8/00
to
Hi Bruce,
Thanks for help. The URL u sent me is no longer exist. Is it the
FindFirstFile you are referring to below?
if so, how to use it? I guess i have to specify the filename to look for
right? what if i don't even know what the filename(s) is. Any easier way
to do so?

Dominic
Bruce Armstrong [TeamSybase] <NOCANSPAM_br...@teamsybase.com>
wrote in message news:6iWWMHUi$GA....@forums.sybase.com...

Bruce Armstrong [TeamSybase]

unread,
Mar 8, 2000, 3:00:00 AM3/8/00
to
The URL I send works fine, you just have to make sure that you have all of
it. It's rather long, so it gets split up by word wrapping. It's a pointer
to the SHFileOperation function.

I'm pretty sure that Roy uses that for his Shell Programming Service object.
You might look at that at:

http://www.pfcguide.com/extensions/ext_0014.asp

On Wed, 8 Mar 2000 16:38:41 -0500,

0 new messages