Hello all! I am trying to query for file metadata using basic-cli, such as size, creation/modified timestamps, permission, and the like. In basic-cli, I see the FileMetadata module (is that the correct noun?), which has some things like bytes : FileMetadata -> U64 where I can get some basic metadata if I had a value of this FileMetadata type. But I don't see how to get such a value. When I search the docs for FileMetadata, I only get this one module with no functions that return this data type. Am I missing something?
Hi @Ben Thomas (enkidatron),
is that the correct noun?
Yes :)
Am I missing something?
That looks like an oversight, I can take care of that next week. If you're in a hurry, you can use Cmd.
Thanks! No need to rush on my account. I will check out Cmd, thanks for the pointer :)
I can take care of that next week
I hope to finish this next week.
File.size_in_bytes! has been merged, I'm working on permissions now.
File permissions functions have been merged: https://github.com/roc-lang/basic-cli/pull/349
File.time_accessed!, File.time_modified! and File.time_created! have been merged: https://github.com/roc-lang/basic-cli/pull/350
How do I get the names of files in a directory? The documentation for Path.display mentions toStrUsingCharset, but the compiler can't find it.
For that matter, how do I rename a file?
Does this help? https://roc-lang.github.io/basic-cli/0.19.0/Dir/#list!
For that matter, how do I rename a file?
I've made a good first issue to add a function for this.
For now, you can do:
Cmd.exec!("mv", [Path.display(old_path), Path.display(new_path)]) ? |err| RenameCmdFailed(err)
The documentation for
Path.displaymentionstoStrUsingCharset, but the compiler can't find it.
The documentation needs to be updated, I've added it to my TODO list. Path.display should work for most cases.
Last updated: Nov 09 2025 at 12:14 UTC