@keshav5252/ozon
v1.0.0
Published
Advanced CLI for File Operations
Maintainers
Keywords
Readme
Ozon CLI
Ozon CLI is a fast, powerful, and user-friendly command-line interface tool for file and directory management. It features atomic history tracking with full undo capability, wildcard support, content-based deduplication, file organization, search, and ZIP archiving.
Installation & Setup
Install via npm (Global)
You can install Ozon CLI globally:
npm install -g @keshav5252/ozonInstall from Source (Development)
- Navigate to the repository directory.
- Install the dependencies:
npm install - Link the package globally to use the
ozoncommand:npm link
Core Command Reference
cdir
Creates one or more directories recursively.
- Usage:
ozon cdir <directory_paths...> - Example:
ozon cdir src/components src/utils - Undoable: Yes (removes created directories if they are still empty).
ddir
Deletes one or more directories. Supports wildcard expansion and path pattern filtering.
- Usage:
ozon ddir <directory_paths_or_wildcards...> [filter_flags] - Example:
ozon ddir * -inc test(deletes all directories in the current folder containing "test"). - Supported Flags:
--startswith/-sw,--endswith/-ew,--includes/-inc. - Undoable: Yes (fully restores deleted folders from backup).
cfile
Creates files. Supports a multiplier syntax to batch-generate files.
- Usage:
ozon cfile <filenames...> - Batch Syntax:
<name>$*<count>.<ext> - Examples:
ozon cfile index.js styles.cssozon cfile page$*5.html(createspage1.htmlthroughpage5.html)
- Undoable: Yes (removes created files).
del
Deletes files. Files are backed up to .ozon/backups for safety. Logs a warning if you try to delete folders.
- Usage:
ozon del <file_paths_or_wildcards...> [filter_flags] - Example:
ozon del *.txt -sw log_(deletes all.txtfiles starting with "log_"). - Supported Flags:
--startswith/-sw,--endswith/-ew,--includes/-inc. - Undoable: Yes (fully restores deleted files from backup).
list
Lists files and directories in the current directory.
- Usage:
ozon list [filter_flags] - Example:
ozon list -inc main - Supported Flags:
--startswith/-sw,--endswith/-ew,--includes/-inc.
move
Moves a file or folder to a new destination.
- Usage:
ozon move <source> <destination> - Example:
ozon move index.js src/index.js - Undoable: Yes (moves item back and restores any overwritten file at destination).
copy
Copies a file or folder to a new destination.
- Usage:
ozon copy <source> <destination> - Example:
ozon copy config.json config.backup.json - Undoable: Yes (deletes copy and restores any overwritten file at destination).
rename
Renames a file or directory. Only accepts new names, not path mappings.
- Usage:
ozon rename <oldName> <newName> - Example:
ozon rename old.js new.js - Undoable: Yes.
stats
Displays a visual storage analysis of files categorized by type (Images, Videos, Docs, Code, Archives, Others).
- Usage:
ozon stats [filter_flags] - Example:
ozon stats -sw main - Supported Flags:
--startswith/-sw,--endswith/-ew,--includes/-inc.
find
Recursively searches for files/folders matching criteria. Can also search inside file contents.
- Usage:
ozon find [filters] - Filters:
--type <type>: Limit search (e.g.file/diror categories likeimages,codeor extensions likejs).--name <name>: Match file/folder name.--text/--search/--content<query>: Search for text inside files (ignores binaries).--startswith/-sw <prefix>: Name must start with prefix.--endswith/-ew <suffix>: Name must end with suffix.--includes/-inc <substring>: Name must contain substring.
- Example:
ozon find --type code --text "import"
organize
Organizes loose files in the current folder into subfolders based on classification criteria.
- Usage:
ozon organize --by <criteria> [filter_flags] - Criteria:
type(Default): Groups files into category folders (Images, Text, Code, etc.).size: Groups files by size tiers (Tiny, Small, Medium, Large, Huge).extension/ext: Groups files by their raw file extension.
- Supported Flags:
--startswith/-sw,--endswith/-ew,--includes/-inc. - Undoable: Yes (moves all organized files back to their original locations).
cleanup
Removes content-based duplicate files, empty directories, and system junk files.
- Usage:
ozon cleanup [options] - Options:
--deep: Scans subdirectories recursively.--empty-dirs: Removes empty folders.--temp-files: Removes system junk files (e.g..DS_Store,Thumbs.db,.tmpfiles).
- Example:
ozon cleanup --deep --empty-dirs - Undoable: Yes (restores all deleted files and recreates all deleted empty folders).
zip
Archives files and folders into a ZIP file.
- Usage:
ozon zip [files_or_wildcards...] [options] - Options:
--output/-out/-o <filename>: Output filename (default:archive.zip).--deep: Searches recursively to package files.--startswith/-sw <prefix>: Filter items starting with prefix.--endswith/-ew <suffix>: Filter items ending with suffix.--includes/-inc <substring>: Filter items containing substring.--type <type>: Filter items by file type/extension.
- Examples:
ozon zip(zips all files in current folder)ozon zip * -sw mainozon zip --type png -o images.zip
- Undoable: Yes (deletes the archive and restores any overwritten file).
undo
Reverts the last action performed in the history.
- Usage:
ozon undo - Supported Actions:
cdir,ddir,cfile,del,move,copy,rename,organize,cleanup,zip.
help
Displays a comprehensive and styled command-line reference listing all commands, parameters, global filter flags, and usage examples.
- Usage:
ozon help,ozon --help,ozon -h, or simplyozonwithout arguments.
Global Filter & Wildcard Flags
Ozon CLI supports powerful filtering flags to limit command execution.
Wildcards (*)
You can pass wildcards (e.g. *, *.txt, src/*) as positional arguments to del, ddir, and zip. The CLI will safely resolve them into a deduplicated list of candidate paths.
Search and Filter Flags
| Flag | Aliases | Description | Supported Commands |
| :--- | :--- | :--- | :--- |
| --startswith | -sw | Filter names starting with a string. | del, ddir, list, stats, find, organize, zip |
| --endswith | -ew | Filter names ending with a string. | del, ddir, list, stats, find, organize, zip |
| --includes | -inc | Filter names containing a string. | del, ddir, list, stats, find, organize, zip |
| --type | | Filter by extension or category. | find, zip |
