I try to delete files with a pattern but I don't get the correct paramater, I tryed this:
pattern$="*.Log"
DeleteFile(pattern$)
even this:
DeleteFile("dh1:", pattern$) but the solution is worst.
Delete files with a pattern
Re: Delete files with a pattern
Have a closer look to the documentation. The signature of the command is:
It says that file$ has to be a directory in this case. And the way how you do it (pattern$ as second parameter), DeleteFile() assumes pattern$ is the callback, which isn't true obviously.
I can't test the code right now, but I think you have to write:
I am unsure about Nil or #NIL, but basically you have to pass those other optional parameters, too, so DeleteFile() knows when the pattern occurs.
Code: Select all
DeleteFile(file$[, callback, userdata, pattern$, matchdir])
I can't test the code right now, but I think you have to write:
Code: Select all
pattern$="*.Log"
DeleteFile("dh1:", Nil, {}, pattern$)
Currently using: Hollywood 9 with Windows IDE and Hollywood 9 with Visual Studio Code and hw4vsc
- Juan Carlos
- Posts: 889
- Joined: Mon Sep 06, 2010 1:02 pm
Re: Delete files with a pattern
Thank you, I'll test your suggestion because this also is useful for the commands copy and remove.
- airsoftsoftwair
- Posts: 5443
- Joined: Fri Feb 12, 2010 2:33 pm
- Location: Germany
- Contact:
Re: Delete files with a pattern
Definitely Nil, not #NIL.Clyde wrote: ↑Tue May 26, 2020 2:43 pm I am unsure about Nil or #NIL, but basically you have to pass those other optional parameters, too, so DeleteFile() knows when the pattern occurs.
@Juan Carlos: Just be very very careful with this command! This command supports full recursion so it can easily kill all files from your HD when called with the wrong parameters or filter patterns