marqdo

16-fs-mid2ok

features/16-fs-mid2.mq.md

Structure

importfs:lib/fs.mq.md
fn · h1Practical filesystem without plugins
comment

make_dirs / remove_tree / stat / walk thicken lib/fs for scripts and tools.

fn · h1main
call> fs.make_dirs path=m9-demo/sub
call> fs.write_text path=m9-demo/readme.txt text=ok
bind `st` = > fs.stat path=m9-demo/readme.txt
call> print text=[size](`st`)
bind `w` = > fs.walk path=m9-demo
bind `n` = > len `w`
call> print text=`n`
call> fs.remove_tree path=m9-demo
Functions
Variables
  • n int
    2
  • st map · 4
    size2
    mtime_unix1789710476
    is_fileTrue
    is_dirFalse
  • w list · 2
    #value
    1readme.txt
    2sub

Execution

2 2

Source

---
title: Mid stdlib — fs make_dirs, walk, stat
description: Recursive dirs, walk, and file metadata (Mid2 M9)
import fs:lib/fs.mq.md
---

# Practical filesystem without plugins

`make_dirs` / `remove_tree` / `stat` / `walk` thicken `lib/fs` for scripts and tools.

# main

> fs.make_dirs path="m9-demo/sub"

> fs.write_text path="m9-demo/readme.txt" text="ok"

**st = > fs.stat path="m9-demo/readme.txt"**
> print text=[size](`st`)

**w = > fs.walk path="m9-demo"**
**n = > len `w`**
> print text=`n`

> fs.remove_tree path="m9-demo"

Variable