# AMPHP v3 — Filesystem Patterns (amphp/file) > All functions are in the `Amp\File` namespace. They are async-safe — they do not block the event loop. --- ## One-shot read and write ```php '/tmp/app/logs/2024/' . $name, $entries); ``` > **Gotcha**: `File\listFiles()` returns **filenames only** (e.g. `['a.log', 'b.log']`), not full paths. Prepend the directory path yourself when you need full paths. --- ## deleteDirectory ```php write($chunk); } $file->end(); // flush and close the write end ``` --- ## openFile() — streaming read ```php read()) { $content .= $chunk; // null signals end of file } // $content === 'chunk1chunk2chunk3' ``` --- ## Append to existing file ```php write("\nline2"); $file->end(); $content = File\read('/tmp/log.txt'); // $content === "line1\nline2" ``` --- ## Full cycle — write, verify, read, cleanup ```php end()` to flush; after reads, the file closes when the resource is destroyed - `File\write()` / `File\read()` are convenience wrappers — equivalent to open + write/read all + close - `File\deleteDirectory()` requires the directory to be empty; delete contents first for non-empty dirs