You must change the file attributes first. See
How to change file attributes programmatically FAQ #15763
>Hi all
>
>DELETE FILE cannot work on read-only files, but I need to use wild-cards to delete read-only attributed files. Any suggestion or should I revert to DOS command to unattrib and delete?
>
>Thanks