Hello @kartik,
The following should help
- realpath — Returns canonicalized absolute pathname
- is_writable — Tells whether the filename is writable
- unlink — Deletes a file
Run your filepath through realpath, then check if the returned path is writable and if so, unlink it.
Hope it helps!!
Thank You!!