API¶
Directory¶
Represents a directory on the local filesystem. Backed by Rust via PyO3.
Constructor¶
Directory(path) — Create a directory reference from a path string. Accepts file://, local:// prefixed paths or plain filesystem paths.
Methods¶
Method |
Description |
|---|---|
|
List immediate children, sorted alphabetically. Returns |
|
List child names as strings. |
|
Recursively list all files under this directory. Returns |
|
Total size in bytes (each file is rounded up to |
|
Canonicalize the path; returns |
|
fnmatch-style glob test. |
|
Return children matching the glob. |
|
Regex match (anchored at start, like Python |
|
Return children matching the regex. |
|
Create a symlink (or hard link) from |
|
Remove a symlink. |
|
Remove the directory recursively. |
|
Whether the path exists on disk. |
|
Raw POSIX path string (no |
|
Same as |
|
Last-modified time as |
Properties¶
Property |
Description |
|---|---|
|
Final path component. |
|
File extension including the leading dot. |
|
Final component without the extension. |
|
All path components as a list of strings. |
|
Parent as a |
Operators¶
Operator |
Description |
|---|---|
|
Join a path component and resolve. |
|
Number of immediate children. |
|
|
|
|
|
Hash based on display path. |
|
Equality based on path. |
|
Lexicographic ordering. |
File¶
Represents a file on the local filesystem. Backed by Rust via PyO3.
Constructor¶
File(path) — Create a file reference from a path string. Accepts file://, local:// prefixed paths or plain filesystem paths.
Methods¶
Method |
Description |
|---|---|
|
File size in bytes, rounded up to |
|
Canonicalize the path; returns |
|
fnmatch-style glob test. |
|
Regex match (anchored at start). |
|
Create a symlink (or hard link) from |
|
Remove a symlink. |
|
Remove the file. |
|
Whether the path exists on disk. |
|
Raw POSIX path string. |
|
Same as |
|
Last-modified time as |
Properties¶
Property |
Description |
|---|---|
|
Final path component (e.g. |
|
Extension including the dot (e.g. |
|
Name without the extension (e.g. |
|
All path components as a list of strings. |
|
Parent as a |
Operators¶
Operator |
Description |
|---|---|
|
Join a path component and resolve. |
|
|
|
|
|
Hash based on display path. |
|
Equality based on path. |
|
Lexicographic ordering. |
Path¶
Factory function that resolves a path string to either a File or Directory.
from organizeit2 import Path
entry = Path(path="/tmp/mydir") # returns Directory if path is a dir, else File
OrganizeIt¶
Entry-point class for filesystem organization. Uses fsspec for filesystem abstraction.
Constructor¶
OrganizeIt(fs=LocalFileSystem()) — Create an organizer with the given filesystem backend.
Methods¶
Method |
Description |
|---|---|
|
Convert a directory path string to a |