| Subject |
Re: new file().Delete() does not delete file |
| From |
Akshat Kapoor <akshat.kapoor@kapoorsons.in> |
| Date |
Mon, 16 Jan 2023 19:40:27 +0530 |
| Newsgroups |
dbase.getting-started |
Good Evening Heinz,
> I am having trouble to delete a file. I tried both versions, DELETE FILE
> and the file object's delete() method, but in some variations I get an
> error, in other cases there is no error, but the file in question is not
> deleted.
>
> I am getting the filename with its full path from an image object, the
> path is correct:
>
> cFile = form.alb_nb.img_cover.datasource
> form.alb_nb.img_cover.datasource = NULL // close file before trying to
> delete it
> ? cFile // check the correct path and filename
> new File().delete("cFile")
new File().delete(cFile) should have worked
new File().delete(&cFile) may work
>
> This produces no error, with or without quotes, while the path is shown
> and is the correct one, but does not delete the file.
>
> When I hard-code the path and filename, like
>
> new
> File().delete("D:\Daten\DataBases\Taurus\Alben\A_002030\Cover_from_BLOB.jpg")
>
> it actually works. What am I doing wrong here, how can I use a variable
> here?
I have no explanation for why.
But the following code works very well for me
new
file().delete(left(mcompany.unc,18)+[c\xampp\htdocs\photo\]+form.disp_invoice)
(There are variables and calculations)
For wildcards I use
cmd = [new
oleautoclient("Scripting.FileSystemObject").deletefile("]+form.path+[*.jpg")]
&cmd
Both are working fine.
Regards
Akshat
|
|