botbook/src/06-gbdialog/keyword-delete-file.md

67 lines
1.2 KiB
Markdown
Raw Normal View History

# DELETE FILE
2025-12-03 19:56:35 -03:00
> **Deprecated:** The `DELETE FILE` keyword has been unified into the [`DELETE`](keyword-delete.md) keyword. Use `DELETE` instead.
2025-12-03 19:56:35 -03:00
---
2025-12-03 19:56:35 -03:00
## Unified DELETE Keyword
2025-12-03 19:56:35 -03:00
The `DELETE` keyword now automatically detects file paths and handles file deletion:
2025-12-03 19:56:35 -03:00
```basic
' Delete a file - just use DELETE
DELETE "path/to/file.txt"
2025-12-03 19:56:35 -03:00
' DELETE auto-detects:
' - URLs → HTTP DELETE
' - table, filter → Database DELETE
' - path → File DELETE
2025-12-03 19:56:35 -03:00
```
---
2025-12-03 19:56:35 -03:00
## Migration
2025-12-03 19:56:35 -03:00
### Old Syntax (Deprecated)
2025-12-03 19:56:35 -03:00
```basic
' Old way - no longer needed
DELETE FILE "temp/report.pdf"
2025-12-03 19:56:35 -03:00
```
### New Syntax (Recommended)
2025-12-03 19:56:35 -03:00
```basic
' New way - unified DELETE
DELETE "temp/report.pdf"
2025-12-03 19:56:35 -03:00
```
---
2025-12-03 19:56:35 -03:00
## Examples
2025-12-03 19:56:35 -03:00
```basic
' Delete a temporary file
DELETE "temp/processed.csv"
2025-12-03 19:56:35 -03:00
' Delete uploaded file
DELETE "uploads/" + filename
2025-12-03 19:56:35 -03:00
' Delete with error handling
ON ERROR RESUME NEXT
DELETE "temp/large-file.pdf"
IF ERROR THEN
TALK "Could not delete file: " + ERROR MESSAGE
2025-12-03 19:56:35 -03:00
END IF
ON ERROR GOTO 0
2025-12-03 19:56:35 -03:00
```
---
2025-12-03 19:56:35 -03:00
## See Also
- [DELETE](keyword-delete.md) — Unified delete keyword (HTTP, Database, File)
- [READ](keyword-read.md) — Read file contents
- [WRITE](keyword-write.md) — Write file contents
- [COPY](keyword-copy.md) — Copy files
- [MOVE](keyword-move.md) — Move/rename files