{"id":19544637,"url":"https://github.com/freshlybrewedcode/photo-cli","last_synced_at":"2025-08-05T06:21:57.387Z","repository":{"id":38981112,"uuid":"496988305","full_name":"FreshlyBrewedCode/photo-cli","owner":"FreshlyBrewedCode","description":"A command line tool for organizing photo and video files using glob patterns and path templates.","archived":false,"fork":false,"pushed_at":"2023-03-02T00:01:05.000Z","size":45,"stargazers_count":3,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T23:42:39.091Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FreshlyBrewedCode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-27T12:29:21.000Z","updated_at":"2024-12-23T11:17:05.000Z","dependencies_parsed_at":"2024-11-11T03:30:12.549Z","dependency_job_id":"599d3d3a-f45c-4cfb-8570-5f395dacd944","html_url":"https://github.com/FreshlyBrewedCode/photo-cli","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.2857142857142857,"last_synced_commit":"763d28a1d001f7102c97f5d3faa2a0ad9eb25ce9"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreshlyBrewedCode%2Fphoto-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreshlyBrewedCode%2Fphoto-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreshlyBrewedCode%2Fphoto-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreshlyBrewedCode%2Fphoto-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreshlyBrewedCode","download_url":"https://codeload.github.com/FreshlyBrewedCode/photo-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252973616,"owners_count":21834105,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T03:30:08.269Z","updated_at":"2025-05-07T23:42:44.784Z","avatar_url":"https://github.com/FreshlyBrewedCode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Photo CLI\n\nA command line tool for organizing photo and video files using glob patterns and path templates.\n\n- [Photo CLI](#photo-cli)\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Import](#import)\n    - [List of available template properties](#list-of-available-template-properties)\n      - [`from` tempalte properties](#from-tempalte-properties)\n        - [Extensions](#extensions)\n      - [`to` template properties](#to-template-properties)\n        - [Dates](#dates)\n    - [Template and preset configuration](#template-and-preset-configuration)\n      - [Example config](#example-config)\n- [Commands](#commands)\n  - [`photo config`](#photo-config)\n  - [`photo help [COMMAND]`](#photo-help-command)\n  - [`photo import [PRESET]`](#photo-import-preset)\n\n# Installation\n\nMake sure NodeJS and npm is installed and run:\n```sh-session\nnpm install -g photo-cli\n```\n\n# Usage\n\n## Import\n\nThe import command copies/moves files from an input directory to an output destination. The input/output paths of each file are determined using a [mustache](https://github.com/janl/mustache.js) template:\n```yaml\nmy-tempalte:\n  - from: \"{{input}}/*.jpg\"\n    to: \"{{output}}/Pictures/{{filename}}\"\n```\nA template consists of an array of `from`/`to` pairs where the rendered `from` string is used as a [glob](https://github.com/isaacs/node-glob) pattern to find input files and the rendered `to` string is used as the output path.\n\nEach file is analyzed using [ExifTool](https://exiftool.org/) to extract image/video metadata. The extracted metadata is passed along when rendering the path template allowing you to use the metadata for the output path:\n```yaml\nmy-tempalte:\n  - from: \"{{input}}/*.jpg\"\n    to: \"{{output}}/Pictures/{{year}}-{{month}}-{{day}}/{{filename}}\"\n```\nIn the example above the extracted date information is used for the name of the output directory.\n\n### List of available template properties\n\n#### `from` tempalte properties\n\n| Name      | Description                                                                 |\n| --------- | --------------------------------------------------------------------------- |\n| `input`   | The input path provided using the preset or the `--input` flag.             |\n| `output`  | The output path provided using the preset or the `--output` flag.           |\n| `project` | The project name provided using the `--project` flag.                       |\n| `ext`     | Object containing different glob patterns for common media file extensions. |\n\n##### Extensions\n\nThe `from` template receives glob patterns for common media file extensions in the `ext` object: `ext.images`, `ext.raws`, `ext.allImages`, `ext.video`, `ext.allMedia`. See [`src/lib/template.ts](src/lib/template.ts) for more info.\nYou can also provide your own glob pattern: \n```\n// Get all .png files\n*.png\n\n// Get .png and .PNG files\n*.{png,PNG}\n```\n\n#### `to` template properties\n\nYou can run the import command with the `--verbose` flag to see the template properties that are used for each file:\n```\nphoto import --input . --template my-template --verbose\n```\n\nHere is an overview of the available properties:\n| Name       | Description                                                                                                                      |\n| ---------- | -------------------------------------------------------------------------------------------------------------------------------- |\n| `exif`     | Object containing the extracted exif metadata. You can access the properties using javascript dot notation e.g. `exif.FileName`. |\n| `filename` | The name of the file with extension. Same as `exif.FileName`.                                                                    |\n| `dirname`  | Base name of the parent directory of the file (not the full path)                                                                |\n\n##### Dates\n\nFor each file the `CreateDate` property from the exif metadata is parsed and provided to the template with the following properties: `year`, `month`, `day`, `hour`, `minute`, `second`. Additionally, you can use custom formatting using the function syntax of mustache: \n```mustache\n{{# date}}yyyy-MM-dd{{/ date}}\n``` \nThe string between the `date` tags will be formated using [date-fns](https://date-fns.org/v2.28.0/docs/format).\n\nIn addition to `date`, two more dates will be passed along: `f_date` (first date) and `l_date` (last date) (as well as `f_year`/`l_year`, etc.). They are the dates of the earliest/latest image/video being imported and can be used to group files taken over a longer period of time.\n\n### Template and preset configuration\n\nThe import command relies on presets and templates that are defined in the photo-cli config file. You can edit the file by running `photo config` and opening the file in your favorite text editor.\n\nThe config file is a yaml file with the following format:\n```yaml\npresets:\n  \u003cname\u003e:\n    input: \u003cinput path\u003e \n    output: \u003coutput path\u003e \n    template: \u003ctempalte name\u003e \ntemplates:\n  \u003cname\u003e:\n    - from: \u003cfrom template\u003e \n      to: \u003cto template\u003e \n```\nTemplates are configured as described above. Presets can be used to provide default values for import command flags `--input`, `--output`, and `--template`.\n\n#### Example config\n\n```yaml\npresets:\n  canon:\n    input: F:/DCIM/100CANON\n    output: M:/Pictures\n    template: date \ntemplates:\n  date:\n    - from: \"{{input}}/{{ext.allMedia}}\"\n      to: \"{{output}}/{{year}}-{{month}}-{{day}}/{{filename}}\"\n```\n\nThe above config contains a preset for importing files from an SD card used in a Canon camera to a pictures directory using a date preset that organizes files in directories by date. Files can be imported using this preset with the following command:\n```\nphoto import canon\n```\n\n# Commands\n\u003c!-- commands --\u003e\n* [`photo config`](#photo-config)\n* [`photo help [COMMAND]`](#photo-help-command)\n* [`photo import [PRESET]`](#photo-import-preset)\n\n## `photo config`\n\nEdit the photo-cli config.\n\n```\nUSAGE\n  $ photo config\n\nDESCRIPTION\n  Edit the photo-cli config.\n```\n\n_See code: [dist/commands/config.ts](https://github.com/FreshlyBrewedCode/photo-cli/blob/v1.0.0/dist/commands/config.ts)_\n\n## `photo help [COMMAND]`\n\nDisplay help for photo.\n\n```\nUSAGE\n  $ photo help [COMMAND] [-n]\n\nARGUMENTS\n  COMMAND  Command to show help for.\n\nFLAGS\n  -n, --nested-commands  Include all nested commands in the output.\n\nDESCRIPTION\n  Display help for photo.\n```\n\n_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v5.1.10/src/commands/help.ts)_\n\n## `photo import [PRESET]`\n\nImports files from the input directory to the output directory using a path template.\n\n```\nUSAGE\n  $ photo import [PRESET] [-i \u003cvalue\u003e] [-o \u003cvalue\u003e] [-t \u003cvalue\u003e] [-P \u003cvalue\u003e] [-p \u003cvalue\u003e] [-c] [-m] [-f]\n    [-v]\n\nFLAGS\n  -P, --preset=\u003cvalue\u003e    name of the import preset\n  -c, --confirm           performs the import without additional user confirmation\n  -f, --force             overwrite existing files in output directory\n  -i, --input=\u003cvalue\u003e     input path\n  -m, --move              move files instead of copy\n  -o, --output=\u003cvalue\u003e    output path\n  -p, --project=\u003cvalue\u003e   the project name of the import\n  -t, --template=\u003cvalue\u003e  name of the template config\n  -v, --verbose\n\nDESCRIPTION\n  Imports files from the input directory to the output directory using a path template.\n\nEXAMPLES\n  $ photo import\n```\n\n_See code: [dist/commands/import.ts](https://github.com/FreshlyBrewedCode/photo-cli/blob/v1.0.0/dist/commands/import.ts)_\n\u003c!-- commandsstop --\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshlybrewedcode%2Fphoto-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffreshlybrewedcode%2Fphoto-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffreshlybrewedcode%2Fphoto-cli/lists"}