Getting windows ‘ShFileOperation’ API to recursively delete files in Delphi -


I am using the following code to delete a large number of files

  FastDelete Function (DIN: Const from string): Boolean; Var fos: TSHFileOpStruct; Zero memory start (@ fos, size of (foss)); Start with fos wFunc: = FO_DELETE; FFlags: = FOF_FILESONLY or FOF_NOCONFIRMATION or FOF_NO_CONNECTED_ELEMENTS or FOF_NOERRORUI or FOF_NO_UI; PFrom: = Pichar (from DIR + '\ *. *' + + + # 0); End; Result: = (0 = Shuffle operation (foss)); End;  

How do I get rid of all the files in the path again and again?

Edit

The problem is that after the removal of the FOF_FILESONLY flag the file is continuously

From:

FOF_NORECURSION < / Strong>

Operation only in local directories do not work in sub-directories recursively, default behavior .

It seems that your answer is right there, it should be automatically absorbed until you ask it.

EDIT: It seems that there is a problem with your flag. You do not need to add them together or since the FOF_NO_UI is already Only includes FOF_NOERRORUI , it can change the value again, and you can accidentally add some things together that add up to FOF_NORECURSION . It should look like this:

  fFlags: = FOF_FILESONLY or FOF_NOCONFIRMATION or FOF_NO_CONNECTED_ELEMENTS or FOF_NOERRORUI or FOF_NO_UI;  

Comments

Popular posts from this blog

MySql variables and php -

url rewriting - How to implement the returnurl like SO in PHP? -

Which Python client library should I use for CouchdB? -