### Install F2 using Go Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Install the F2 tool using the `go install` command. This method requires Go v1.23 or later to be installed on your system. ```bash go install github.com/ayoisaiah/f2/v2/cmd/f2@latest ``` -------------------------------- ### Install F2 on Windows using Winget Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md F2 can be installed directly using the native Windows Package Manager, Winget. ```sh winget install ayoisaiah.f2 ``` -------------------------------- ### Install F2 using NPM Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Install the F2 package globally via `npm` if you have Node.js installed. Note that compatibility with other package managers is not guaranteed. ```bash npm i @ayoisaiah/f2 -g ``` -------------------------------- ### Install F2 on Windows using Scoop Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Install F2 using Scoop, a popular package manager for Windows. This involves adding the F2 scoop bucket and then installing the package. ```sh scoop bucket add ayoisaiah-scoop-bucket https://github.com/ayoisaiah/scoop-bucket ``` ```sh scoop install f2 ``` -------------------------------- ### Install F2 on Windows via Binary Download Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Download the F2 binary archive for Windows, extract its contents, and then move the executable to a directory in your system's PATH to make it accessible from the command line. ```sh # Download the archive curl.exe -LO https://github.com/ayoisaiah/f2/releases/download/v2.0.3/f2_2.0.3_windows_amd64.tar.gz # Extract the contents tar -xvzf f2_2.0.3_windows_amd64.tar.gz # Move the binary to a directory in your PATH move f2.exe C:\Users\\.bin ``` -------------------------------- ### Install F2 on Debian/Ubuntu via .deb package Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Debian and Ubuntu users can download and install the F2 .deb package directly from the releases page using `curl` and `dpkg`. ```bash # Download the deb package curl -LO https://github.com/ayoisaiah/f2/releases/download/v2.0.3/f2_2.0.3_linux_amd64.deb # Install the package sudo dpkg -i f2_2.0.3_linux_amd64.deb ``` -------------------------------- ### Install F2 on Linux via Binary Download Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Download the F2 binary archive for Linux, extract its contents, make the binary executable, and then move it to a directory in your system's PATH to make it accessible from the command line. ```bash # Download the archive curl -LO https://github.com/ayoisaiah/f2/releases/download/v2.0.3/f2_2.0.3_linux_amd64.tar.gz # Extract the contents tar -xvzf f2_2.0.3_linux_amd64.tar.gz # Make the binary executable chmod +x f2 # Move the binary to a directory in your $PATH sudo mv f2 /usr/local/bin ``` -------------------------------- ### Install F2 on Fedora/CentOS via .rpm package Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Fedora or CentOS users can install F2 by downloading the .rpm package from the releases page and installing it using `rpm`. ```bash # Download the rpm package curl -LO https://github.com/ayoisaiah/f2/releases/download/v2.0.3/f2_2.0.3_linux_amd64.rpm # Install the package sudo rpm -i f2_2.0.3_linux_amd64.rpm ``` -------------------------------- ### Install F2 on Windows using Chocolatey Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Install F2 using Chocolatey, a package manager for Windows, by running a simple command from your command line or PowerShell. ```sh choco install f2 ``` -------------------------------- ### Install F2 on macOS via Binary Download Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Download the F2 binary archive for macOS, extract its contents, make the binary executable, and then move it to a directory in your system's PATH to make it accessible from the command line. ```bash # Download the archive curl -LO https://github.com/ayoisaiah/f2/releases/download/v2.0.3/f2_2.0.3_darwin_amd64.tar.gz # Extract the contents tar -xvzf f2_2.0.3_darwin_amd64.tar.gz # Make the binary executable chmod +x f2 # Move the binary to your PATH sudo mv f2 /usr/local/bin ``` -------------------------------- ### Install F2 on macOS using Homebrew Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md Alternatively, F2 can be easily installed on macOS using the Homebrew package manager. ```sh brew install f2 ``` -------------------------------- ### Install F2 on Arch Linux via AUR Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/getting-started.md For Arch Linux users, F2 is available through the Arch User Repository (AUR). Use an AUR helper like `yay` to install the `f2-bin` package. ```bash yay -S f2-bin ``` -------------------------------- ### Running the F2 Documentation Site Locally Source: https://github.com/ayoisaiah/f2-docs/blob/master/README.md This snippet provides the necessary steps to clone the F2 documentation repository and run the site on your local machine. It involves using Git for cloning and npm for dependency installation and starting the development server. ```bash git clone https://github.com/ayoisaiah/f2-docs/ ``` ```bash cd f2-docs ``` ```bash npm install ``` ```bash npm run docs:dev ``` -------------------------------- ### f2 Command-Line Options Reference Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/cli-options.md Comprehensive reference for `f2` command-line arguments, flags, and options, including their purpose, syntax, and examples. ```APIDOC f2 v2.1.2 Ayooluwa Isaiah f2 bulk renames files and directories, matching files against a specified pattern. It employs safety checks to prevent accidental overwrites and offers several options for fine-grained control over the renaming process. Project repository: https://github.com/ayoisaiah/f2 USAGE f2 FLAGS [OPTIONS] [PATHS TO FILES AND DIRECTORIES...] command | f2 FLAGS [OPTIONS] POSITIONAL ARGUMENTS [PATHS TO FILES AND DIRECTORIES...] Optionally provide one or more files and directories to search for matches. If omitted, it searches the current directory alone. Also, note that directories are not searched recursively unless --recursive/-R is used. FLAGS --csv Load a CSV file, and rename according to its contents. -f, --find A regular expression pattern used for matching files and directories. It accepts the syntax defined by the RE2 standard and defaults to .* if omitted which matches the entire file/directory name. When -s/--string-mode is used, this pattern is treated as a literal string. -r, --replace The replacement string which replaces each match in the file name. It supports capture variables, built-in variables, and exiftool variables. If omitted, it defaults to an empty string. -u, --undo Undo the last renaming operation performed in the current working directory. OPTIONS --allow-overwrites Allows the renaming operation to overwrite existing files. Caution: Using this option can lead to unrecoverable data loss. -c, --clean Clean empty directories that were traversed in a renaming operation. -E, --exclude Excludes files and directories that match the provided regular expression. This flag can be repeated to specify multiple exclude patterns. Example: -E 'json' -E 'yml' (filters out JSON and YAML files) -E 'json|yaml' (equivalent to the above) Note: This does not prevent recursing into matching directories (use --exclude-dir instead). --exclude-dir Prevents F2 from recursing into directories that match the provided regular expression pattern. --exiftool-opts Provides options to customize Exiftool's output when using ExifTool variables in replacement patterns. Supported options: --api --charset --coordFormat --dateFormat --extractEmbedded Example: $ f2 -r '{xt.GPSDateTime}' --exiftool-opts '--dateFormat %Y-%m-%d' -x, --exec Executes the renaming operation and applies the changes to the filesystem. -F, --fix-conflicts Automatically fixes renaming conflicts using predefined rules. --fix-conflicts-pattern Specifies a custom pattern for renaming files when conflicts occur. The pattern should be a valid Go format string containing a single '%d' placeholder for the conflict index. Example: '_%02d' (generates _01, _02, etc.) If not specified, the default pattern '(%d)' is used. -H, --hidden Includes hidden files and directories in the search and renaming process. On Linux and macOS, hidden files are those that start with a dot character. On Windows, only files with the 'hidden' attribute are considered hidden. To match hidden directories as well, combine this with the -d/--include-dir flag. -I, --include Only includes files that match the provided regular expression instead of all files matched by the --find flag. This flag can be repeated to specify multiple include patterns. Example: -I 'json' -I 'yml' (only include JSON and YAML files) -d, --include-dir Includes matching directories in the renaming operation (they are excluded by default). -i, --ignore-case Ignores case sensitivity when searching for matches. -e, --ignore-ext Ignores the file extension when searching for matches. --json Produces JSON output, except for error messages which are sent to the standard error. -m, --max-depth Limits the depth of recursive search. Set to 0 (default) for no limit. --no-color Disables colored output. -D, --only-dir Renames only directories, not files (implies -d/--include-dir). -p, --pair Enable pair renaming to rename files with the same name (but different extensions) in the same directory to the same new name. In pair mode, file extensions are ignored. Example: Before: DSC08533.ARW DSC08533.JPG DSC08534.ARW DSC08534.JPG $ f2 -r "Photo_{%03d}" --pair -x After: Photo_001.ARW Photo_001.JPG Photo_002.ARW Photo_002.JPG --pair-order Order the paired files according to their extension. This helps you control the file to be renamed first, and whose metadata should be extracted when using variables. Example: --pair-order 'dng,jpg' # rename dng files before jpg --pair-order 'xmp,arw' # rename xmp files before arw --quiet ``` -------------------------------- ### F2 General Usage Example with Multiple Paths Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This example demonstrates how to use F2 to apply a find and replace operation across multiple specified paths, including both a directory and a specific file. It shows the `-f` (find) and `-r` (replace) flags in action, targeting 'a' for replacement with 'b'. ```bash f2 -f 'a' -r 'b' path/to/dir path/to/file.txt ``` -------------------------------- ### Example of Current Image Library Organization Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md Illustrates a typical image library structure where photos are grouped by event or general categories before re-organization. This shows a mix of top-level files and event-specific subdirectories. ```text . ├── birthday-2024 │   ├── _DSC0430.ARW │   ├── _DSC0430.JPG │   ├── _DSC0431.ARW │   └── _DSC0431.JPG ├── _DSC0560.ARW ├── _DSC0560.JPG ├── _DSC0561.ARW ├── _DSC0561.JPG ├── family trip - berlin │   ├── _DSC1767.ARW │   ├── _DSC1767.JPG │   ├── _DSC1769.ARW │   ├── _DSC1769.JPG │   ├── _DSC1770.ARW │   └── _DSC1770.JPG ├── family trip - london │   ├── _DSC0090.ARW │   ├── _DSC0090.JPG │   ├── _DSC0091.ARW │   └── _DSC0091.JPG └── my-wedding ├── DSC05194.ARW ├── DSC05194.JPG ├── DSC05195.ARW └── DSC05195.JPG ``` -------------------------------- ### Setting F2_DEFAULT_OPTS Environment Variable Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/cli-options.md Example of how to set the F2_DEFAULT_OPTS environment variable to override default f2 options, enabling execute mode and ignoring file extensions. ```Shell export F2_DEFAULT_OPTS=--exec --ignore-ext ``` -------------------------------- ### Example Output of F2 File Renaming with ExifTool Variables Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/exiftool-variables.md This table illustrates the result of applying the F2 renaming command using ExifTool variables. It shows how original filenames are transformed into a clean, metadata-driven naming convention, demonstrating the effectiveness of the integration. ```text ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ******************************************************************************************************* | | 1984-george-orwell.epub | 1984 George Orwell - George Orwell.epub | ok | | bunyan-pilgrim-s-progress.epub | The Pilgrim's Progress - John Bunyan.epub | ok | | Dracula.epub | Dracula - Bram Stoker.epub | ok | | Emma - Austen Jane.epub | Emma - Jane Austen.epub | ok | | Friend Island.epub | Friend Island - Francis Stevens.epub | ok | | hill-think-and-grow-rich.epub | Think and Grow Rich - Napoleon Hill.epub | ok | | Leviathan by Thomas Hobbes.epub | Leviathan - Thomas Hobbes.epub | ok | | The Lost World by Arthur Conan Doyle.epub | The Lost World - Arthur Conan Doyle.epub | ok | | The Mysteries of Udolpho.epub | The Mysteries of Udolpho - Ann Ward Radcliffe.epub | ok | | The Night Land.epub | The Night Land - William Hope Hodgson.epub | ok | | The Parasite.epub | The Parasite: A Story - Arthur Conan Doyle.epub | ok | | The Raven.epub | The Raven - Edgar Allan Poe.epub | ok | | The Trial.epub | The Trial - Franz Kafka.epub | ok | | the-shunned-house.epub | The Shunned House - H. P. Lovecraft.epub | ok | | Ulysses by James Joyce.epub | Ulysses - James Joyce.epub | ok | | War and Peace by Graf Leo Tolstoy.epub | War and Peace - Graf Leo Tolstoy.epub | ok | └─────────────────────────────────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Example ExifTool Command for EPUB Metadata Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/exiftool-variables.md This is a concrete example of using ExifTool to extract metadata from an EPUB file named `1984-george-orwell.epub`. The output will be a JSON array containing various metadata fields for the specified file. ```bash exiftool -j 1984-george-orwell.epub ``` -------------------------------- ### Example of Desired Date-Based Image Library Structure Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md Shows the target folder structure, organizing images hierarchically by Year, Month, and Day, with files named sequentially. This structure is achieved by extracting creation dates from image metadata. ```text 2024 ├── 05-May │ └── 2024-05-30 │ ├── 001.ARW │ ├── 001.JPG │ └── 002.JPG └── 06-Jun ├── 2024-06-27 │ ├── 001.JPG │ └── 001.ARW ``` -------------------------------- ### Include Files Matching Regex Pattern with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This command renames 'sample' to 'example' but only for files whose names contain the string 'flac', using the `-I` (include) flag. This allows for regex-based inclusion, similar to how `-E` is used for exclusion, to narrow down the target files. ```bash f2 -f "sample" -r "example" -I flac ``` ```text ┌───────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ********************************************* | | sample_flac.flac | example_flac.flac | ok | └───────────────────────────────────────────────┘ ``` -------------------------------- ### Example of a File Pair Structure Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/pair-renaming.md Illustrates the concept of a file pair, where multiple files share the same base name but differ in extension, typically found with image or video files. ```text image_001.dng image_001.jpg image_001.hif image_001.xmp ``` -------------------------------- ### Target Specific Files for Renaming by Direct Path with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This command renames occurrences of 'sample' to 'example' but restricts the operation to only the explicitly listed files: `sample_flac.flac` and `sample_mp3.mp3`. This method bypasses the find pattern for unlisted files, ensuring precise targeting. ```text sample_flac.flac sample_mp3.mp3 sample_ogg.ogg ``` ```bash f2 -f "sample" -r "example" sample_flac.flac sample_mp3.mp3 ``` ```text ┌───────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ********************************************* | | sample_flac.flac | example_flac.flac | ok | | sample_mp3.mp3 | example_mp3.mp3 | ok | └───────────────────────────────────────────────┘ ``` -------------------------------- ### Example of Final Organized File Structure Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md This `text` block illustrates the resulting directory structure after executing the `f2` command, showing how files are organized by year, month, and day, with paired RAW and JPG files indexed sequentially within each day's directory. ```text └── 2024 ├── 05-May │   └── 2024-05-30 │   ├── 001.ARW │   ├── 001.JPG │   ├── 002.ARW │   └── 002.JPG ├── 06-Jun │   ├── 2024-06-27 │   │   ├── 001.ARW │   │   ├── 001.JPG │   │   ├── 002.ARW │   │   ├── 002.JPG │   │   ├── 003.ARW │   │   └── 003.JPG │   └── 2024-06-28 │   ├── 001.ARW │   ├── 001.JPG │   ├── 002.ARW │   ├── 002.JPG │   ├── 003.ARW │   ├── 003.JPG │   ├── 004.ARW │   └── 004.JPG └── 07-Jul └── 2024-07-02 ├── 001.ARW ├── 001.JPG ├── 002.ARW └── 002.JPG ``` -------------------------------- ### Example Renaming Results with Exif Variables Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/exif-variables.md This table illustrates the output of the `f2` renaming operation when Exif variables are applied to various image files. It shows how original filenames are transformed into new, descriptive names based on their embedded metadata. ```text +------------------------------------------------------------------------------------+ | ORIGINAL | RENAMED | STATUS | +------------------------------------------------------------------------------------+ | bike.jpeg | SM-G975F-4.32mm-ISO50-samsung-bike.jpeg | ok | | proraw.dng | iPhone 12 Pro Max-5.1mm-ISO32-Apple-proraw.dng | ok | | tractor-raw.cr2 | Canon EOS 5D Mark III-24mm-ISO200-Canon-tractor-raw.cr2 | ok | +------------------------------------------------------------------------------------+ ``` -------------------------------- ### Use Multiple Index Formats in f2 Filename Renaming Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md Shows how to incorporate multiple index formats within a single filename using `f2`. This example combines a decimal index (starting at 10, padded to 5 digits) and a Roman numeral index (padded to 3 digits) for complex renaming patterns. ```bash f2 -r "{10%05d}-unsplash-image-{%03dr}" -e ``` ```text ┌────────────────────────────────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ****************************************************************************************** | | kevin-wong-tt7aK2yV7xo-unsplash.jpg | 00010-unsplash-image-I.jpg | ok | | nathan-anderson-7TGVEgcTKlY-unsplash.jpg | 00011-unsplash-image-II.jpg | ok | | ... | ... | ... | └────────────────────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Example Output of F2 File Renaming Command Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/date-variables.md This snippet shows the expected output when the F2 command for renaming `.webp` files by modification date is executed. It illustrates how original filenames are transformed into new names incorporating the formatted modification date and a sequential number. ```text *---------------------------------------------------------* | ORIGINAL | RENAMED | STATUS | *---------------------------------------------------------* | 34e7dcd7.webp | Jun-18-2022_image001.webp | ok | | 7zwffegy91871.webp | Jun-03-2022_image002.webp | ok | | alan_p.webp | May-29-2022_image003.webp | ok | | eiuz4tzc2le71.webp | Jun-03-2022_image004.webp | ok | | image-2-1.webp | Apr-23-2022_image005.webp | ok | | qeila4tnvr971.webp | Jun-03-2022_image006.webp | ok | *---------------------------------------------------------* ``` -------------------------------- ### Rename Files with Zero-Padded Index using F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md This example demonstrates how to rename a series of files using F2, applying a three-digit zero-padded index to create names like 'unsplash-image-001.jpg', 'unsplash-image-002.jpg', etc. ```bash f2 -r "unsplash-image-{%03d}" -e ``` -------------------------------- ### F2 Limiting Replacements to First Occurrence Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This example demonstrates how to limit the number of replacements to only the first occurrence of a match in each filename using the `-l 1` option. This provides precise control, ensuring that only the initial instance of 'abc' is replaced with '123' in every file. ```bash f2 -f 'abc' -r '123' -l 1 ``` -------------------------------- ### Basic Variable Usage for File Renaming in F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/how-variables-work.md This snippet demonstrates the fundamental use of variables in F2's replacement strings. It shows how to reference the parent directory (`{p}`), original filename (`{f}`), and file extension (`{ext}`) to construct new filenames. The example renames files by prepending the parent directory name. ```bash house-chores/ ├── cleaning.md ├── laundry.md ├── mowing.md └── washing.md ``` ```bash f2 -r "{p}_{f}{ext}" ``` ```text *—————————————*——————————————————————————*————————* | ORIGINAL | RENAMED | STATUS | *—————————————*——————————————————————————*————————* | cleaning.md | house-chores_cleaning.md | ok | | laundry.md | house-chores_laundry.md | ok | | mowing.md | house-chores_mowing.md | ok | | washing.md | house-chores_washing.md | ok | *—————————————*——————————————————————————*————————* ``` -------------------------------- ### Integrating F2 with Find for Date-Based Renaming Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This example shows how F2 can be integrated with other command-line tools using pipes. It uses `find` to locate files modified more than 30 days ago and then pipes their names to F2, which renames them to include their modification date in YYYY-MM-DD format, followed by the original filename. ```bash find -type f -mtime +30 | f2 -r '{mtime.YYYY}-{mtime.MM}-{mtime.DD}_{f}{ext}' ``` -------------------------------- ### Auto Increment File Index in Steps of 5 with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md Demonstrates how to rename files using `f2`, where the numeric index starts at 1 and increments by 5 for each subsequent file. This is useful for creating sequences with specific gaps. ```bash f2 -r "unsplash-image-{%03d5}" -e ``` ```text ┌──────────────────────────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ************************************************************************************ | | kevin-wong-tt7aK2yV7xo-unsplash.jpg | unsplash-image-001.jpg | ok | | nathan-anderson-7TGVEgcTKlY-unsplash.jpg | unsplash-image-006.jpg | ok | | ... | ... | ... | └──────────────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Rename Files Using Regex Capture Variables with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This example demonstrates how to use `f2` to rename files by extracting specific parts of the original filename using regular expression capture groups. The captured groups are then referenced in the replacement string to construct the new filename, allowing for flexible reordering and simplification of names. ```bash f2 -f '.*-(.*)_(.*)' -r '$1. $2' -e ``` -------------------------------- ### Customize Conflict Resolution Patterns in F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/conflict-detection.md Explains how to use the `--fix-conflicts-pattern` flag with F2 to define a custom Go format string for renaming files during conflict resolution. It demonstrates the default pattern and various custom pattern examples. ```text Default pattern example: file(1).txt, file(2).txt, file(3).txt, etc. ``` ```bash f2 ... -F --fix-conflicts-pattern "_%02d" ``` ```text Resulting filenames: file_01.txt, file_02.txt, file_03.txt, etc. ``` ```text Other pattern examples: - `-%d`: file-1.txt, file-2.txt - `_v%d`: file_v1.txt, file_v2.txt - `-%03d`: file-001.txt, file-002.txt ``` -------------------------------- ### Sorting Files by Arbitrary Integer Variable with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/sorting.md Shows how to sort files using an arbitrary integer variable with F2's `--sort int_var` and `--sort-var` flags. This example sorts image files by their ISO value, resolving the `{xt.ISO}` attribute. ```bash f2 -f 'image' -r 'pic-{%03d}' --sort int_var --sort-var '{xt.ISO}' ``` -------------------------------- ### F2 Limiting Replacements from End of File Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This snippet shows how to limit replacements by starting from the end of the filename using a negative number with the `-l` option, specifically `-l -1` to replace only the last occurrence. This offers flexibility in targeting specific matches within a filename. ```bash f2 -f 'abc' -r '123' -l -1 ``` -------------------------------- ### Applying String Transformations to F2 Variables Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/how-variables-work.md This example illustrates how to apply string transformations to variables within F2 replacement strings. Specifically, it uses the `.up` transform to convert the filename (`{f}`) to uppercase during the renaming process, demonstrating how to modify variable values dynamically. ```bash f2 -r "{p}_{f.up}{ext}" ``` ```text *—————————————*——————————————————————————*————————* | ORIGINAL | RENAMED | STATUS | *—————————————*——————————————————————————*————————* | cleaning.md | house-chores_CLEANING.md | ok | | laundry.md | house-chores_LAUNDRY.md | ok | | mowing.md | house-chores_MOWING.md | ok | | washing.md | house-chores_WASHING.md | ok | *—————————————*——————————————————————————*————————* ``` -------------------------------- ### Basic Renaming with Parent Directory, Filename, and Extension using f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/filename-path-variables.md This command demonstrates how to rename files by combining the immediate parent directory's name, the original filename without its extension, and the original file extension. For example, a file located at `/home/user/docs/document.txt` would be renamed to `docs_document.txt`. ```bash f2 -r "{p}_{f}{ext}" ``` -------------------------------- ### Customizing Parent Directory Variables in F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/how-variables-work.md This snippet demonstrates advanced customization of the parent directory variable (`{p}`) in F2. By prefixing `{p}` with a number (e.g., `{2p}`, `{3p}`), users can extract specific directory components from the absolute path. The example combines multiple path components with string transformations for complex renaming operations. ```text /home/user/dev/demo/f2/docs/house-chores ``` ```bash f2 -r "{3p.up}_{2p}_{p}_{f.up}{ext}" ``` ```text *—————————————*——————————————————————————————————*————————* | ORIGINAL | RENAMED | STATUS | *—————————————*——————————————————————————————————*————————* | cleaning.md | F2_docs_house-chores_CLEANING.md | ok | | laundry.md | F2_docs_house-chores_LAUNDRY.md | ok | | mowing.md | F2_docs_house-chores_MOWING.md | ok | | washing.md | F2_docs_house-chores_WASHING.md | ok | *—————————————*——————————————————————————————————*————————* ``` -------------------------------- ### Perform an Example File Renaming Operation with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/undoing-mistakes.md This command renames a series of image files with zero-padded numbers using F2. It matches all files and renames them to 'unsplash-image-XXX.jpg'. After execution, a backup file is automatically created. ```bash f2 -f '.*' -r "unsplash-image-%03d" -e ``` ```text ┌─────────────────────────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | *********************************************************************************** | | kevin-wong-tt7aK2yV7xo-unsplash.jpg | unsplash-image-001.jpg | ok | | nathan-anderson-7TGVEgcTKlY-unsplash.jpg | unsplash-image-002.jpg | ok | | photo-1434907652076-85f8401482c3.jpg | unsplash-image-003.jpg | ok | | photo-1510272839903-5112a2e44bc6.jpg | unsplash-image-004.jpg | ok | | photo-1521579971123-1192931a1452.jpg | unsplash-image-005.jpg | ok | | samuele-errico-piccarini-t4OxCpKie70-unsplash.jpg | unsplash-image-006.jpg | ok | | valentin-salja-VMroCCpP648-unsplash.jpg | unsplash-image-007.jpg | ok | └─────────────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Auto Increment File Index in Negative Steps with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md Illustrates renaming files with `f2` where the numeric index starts at 20 and decrements by 2 for each file. This allows for reverse or decreasing numerical sequences in filenames. ```bash f2 -r "unsplash-image-{20%03d-2}" -e ``` ```text ┌──────────────────────────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ************************************************************************************ | | kevin-wong-tt7aK2yV7xo-unsplash.jpg | unsplash-image-020.jpg | ok | | nathan-anderson-7TGVEgcTKlY-unsplash.jpg | unsplash-image-018.jpg | ok | | ... | ... | ... | └──────────────────────────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### Rename Audio Files Using ID3 Metadata with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/id3-variables.md This example demonstrates how to use the `f2` command to automatically rename and organize audio files based on their ID3 metadata. It creates a folder structure of `artist/album/title` and includes the track number in the filename, ensuring smooth processing even with incomplete metadata. ```bash f2 -f '(\d+).*' -r '{id3.artist}/{id3.album}/${1}_{id3.title}{ext}' ``` -------------------------------- ### Applying Consistent Pair Renaming with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/pair-renaming.md Demonstrates using F2's `-p` or `--pair` option to apply a consistent renaming scheme across all files within a pair, preserving their relationship. The example shows the `f2` command and its resulting output, where date and sequence variables are applied uniformly. ```bash f2 -r "Wedding_{x.cdt.YYYY}{x.cdt.MM}{x.cdt.DD}_{%03d}" -p ``` ```text *——————————————*——————————————————————————*————————* | ORIGINAL | RENAMED | STATUS | *——————————————*——————————————————————————*————————* | DSC09137.arw | Wedding_20241013_001.arw | ok | | DSC09137.hif | Wedding_20241013_001.hif | ok | | DSC09137.jpg | Wedding_20241013_001.jpg | ok | | DSC09138.arw | Wedding_20241013_002.arw | ok | | DSC09138.hif | Wedding_20241013_002.hif | ok | | DSC09138.jpg | Wedding_20241013_002.jpg | ok | *——————————————*——————————————————————————*————————* ``` -------------------------------- ### Customizing File Extensions with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/filename-path-variables.md This command illustrates how to change a file's extension to a custom one (e.g., '.bak') while retaining the original filename. This is useful for creating backups or changing file types. For example, `document.txt` would become `document.bak`. ```bash f2 -r "{f}.bak" ``` -------------------------------- ### Rename Files Skipping Specific Indices using F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md This F2 example shows how to rename files while explicitly skipping certain numbers in the index range, such as 1-5 and 10-20, ensuring the index continues from the next available number. ```bash f2 -r "unsplash-image-{%03d<1-5;10-20>}" -e ``` -------------------------------- ### Example CSV Data for F2 Renaming by Column Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/csv-renaming.md Illustrates the structure of a CSV file used with F2, including columns like Filename, Podcast name, Description, Date, and Duration. This data serves as input for renaming operations that reference columns by their numerical index. ```csv Filename,Podcast name,Description,Date,Duration episode-001.mp3,History on Steroids,The story of WW2,27-Aug-2006,2hrs47mins S04E23.m4a,Premier League Show,Where will Sancho fit in at United,31-July-2021,30mins ``` -------------------------------- ### Sorting Files with F2 using --sort and --sortr Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/sorting.md Demonstrates how to use the `--sort` flag for ascending order and `--sortr` for descending order when renaming files with F2. The example uses `natural` sorting to order filenames containing numbers naturally. ```bash f2 -f 'image' -r 'pic-{%03d}' --sort natural ``` ```bash f2 -f 'image' -r 'pic-{%03d}' --sortr natural ``` -------------------------------- ### Reset Index Per Directory with f2 for Recursive Renaming Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md Illustrates the effect of using the `--reset-index-per-dir` option with `f2` during recursive renaming. The index is reset to its starting value for each new directory encountered, allowing for independent numbering sequences within subdirectories. ```bash f2 -r '{%03d}' -R --reset-index-per-dir ``` ```text *——————————————————————————*——————————————————*————————* | ORIGINAL | RENAMED | STATUS | *——————————————————————————*——————————————————*————————* | 01.txt | 001 | ok | | 02.txt | 002 | ok | | 03.txt | 003 | ok | | house-chores/cleaning.md | house-chores/001 | ok | | house-chores/laundry.md | house-chores/002 | ok | | house-chores/mowing.md | house-chores/003 | ok | *——————————————————————————*——————————————————*————————* ``` -------------------------------- ### Accessing Higher-Level Directories in f2 Renaming Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/filename-path-variables.md This command shows how to incorporate the name of a directory two levels up in the file's path into the new filename. This is useful for more complex hierarchical renaming schemes. For example, for a file located at `/home/user/projects/docs/file.txt`, this would produce `projects_file.txt`. ```bash f2 -r "{2p}_{f}{ext}" ``` -------------------------------- ### Chaining F2 Operations to Remove Specific Characters Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md Building on the previous example, this F2 command illustrates how to append an additional `-f` flag without a corresponding `-r` flag to effectively remove specified characters (in this case, digits) from the file names after previous renaming operations, demonstrating selective removal within a chained command. ```bash f2 -f '[^a-zA-Z]*([^(]*) \\(([^)]*)\\).*\\.iso$' -r 'Games/$2/$1{ext}' -f ' - ([^.]*)' -r ' ({<$1>.up})' -f ' \\d+' ``` -------------------------------- ### F2 Command Line General Usage Syntax Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This snippet illustrates the general syntax for the F2 command-line utility, outlining the placement of flags, options, and file/directory paths. It notes that one of the `-f`, `-u`, `-r`, or `--csv` flags is mandatory for an operation, and F2 defaults to the current directory if no paths are specified. ```text f2 FLAGS [OPTIONS] [PATHS TO FILES OR DIRECTORIES...] ``` -------------------------------- ### Verify F2 Default Options Application with Verbose Output Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/env-variables.md Illustrates how to run an F2 command with `F2_DEFAULT_OPTS` set and the `--verbose` option to confirm which default settings are being applied from the environment, showing the effect on a hidden file. ```bash F2_DEFAULT_OPTS="-V -H" f2 -f 'hid' ``` ```text default option '--hidden' applied from the environment: true default option '--verbose' applied from the environment: true *——————————*—————————*————————* | ORIGINAL | RENAMED | STATUS | *——————————*—————————*————————* | .hidden | .den | ok | *——————————*—————————*————————* ``` -------------------------------- ### Output of F2 Command with Target Directory Specified Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md Illustrates the effect of using the `--target-dir` flag, showing how files are moved to the specified root directory instead of being nested within their original parent folders. This ensures a clean, top-level date-based organization. ```text *———————————————————————————————————*—————————————————————————————————————*————————* | ORIGINAL | RENAMED | STATUS | ``` -------------------------------- ### Include Directories in Renaming with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md Demonstrates how to include directories in the renaming operation using the `f2` command with the `-d` flag, replacing 'pic' with 'image' in both files and directories. ```bash f2 -f 'pic' -r 'image' -d ``` -------------------------------- ### Rename Files with Roman Numeral Index using F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/indexing.md This F2 command renames files using Roman numeral indexing, starting from 'X' (10), suitable for unique sequencing. Roman numerals are supported up to 3999. ```bash f2 -r "unsplash-image-{10%03dr}" -e ``` -------------------------------- ### Supported ExifTool Options for f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/exiftool-variables.md A list of ExifTool options that can be passed to `f2` using the `--exiftool-opts` flag to customize variable output. ```text --api --charset --coordFormat --dateFormat --extractEmbedded ``` -------------------------------- ### f2 Command-Line Flags Reference Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/cli-options.md Detailed reference for command-line flags available in the f2 file renaming tool, including their purpose and usage. ```APIDOC Flag: -R, --recursive Description: Recursively traverses directories when searching for matches. Flag: -l, --replace-limit Description: Limits the number of replacements made on each matched file. 0 (default) means replace all matches. Negative values replace from the end of the filename. Flag: --reset-index-per-dir Description: Resets the auto-incrementing index when entering a new directory during a recursive operation. Flag: --sort Description: Sorts matches in ascending order based on the provided criteria. Allowed values: - 'default': Lexicographical order. - 'size': Sort by file size. - 'natural': Sort according to natural order. - 'mtime': Sort by file last modified time. - 'btime': Sort by file creation time. - 'atime': Sort by file last access time. - 'ctime': Sort by file metadata last change time. - 'time_var': Sort by time variable. - 'int_var': Sort by integer variable. - 'string_var': Sort lexicographically by string variable. Flag: --sortr Description: Accepts the same values as --sort but sorts matches in descending order. Flag: --sort-per-dir Description: Ensures sorting is performed separately within each directory rather than globally. Flag: --sort-var Description: Active when using --sort/--sortr with time_var, int_var, or string_var. Provide a supported variable to sort the files based on file metadata. See https://f2.freshman.tech/guide/sorting for more details. Flag: -s, --string-mode Description: Treats the search pattern (specified by -f/--find) as a literal string instead of a regular expression. Flag: -t, --target-dir Description: Specify a target directory to move renamed files and reorganize your filesystem. Flag: -V, --verbose Description: Enables verbose output during the renaming operation. ``` -------------------------------- ### List of Configurable Options for F2_DEFAULT_OPTS Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/env-variables.md Provides a comprehensive list of command-line options that can be configured within the `F2_DEFAULT_OPTS` environment variable to customize F2's default behavior. ```text --exclude --exclude-dir --exec --exiftool-opts --fix-conflicts --fix-conflicts-pattern --hidden --ignore-case --ignore-ext --include-dir --json --no-color --quiet --recursive --sort --sortr --reset-index-per-dir --string-mode --verbose ``` -------------------------------- ### Directory Structure Before Renaming Operation Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/recovering-from-failures.md Illustrates the initial directory layout with JPEG files before any renaming attempts are made by F2. ```text ├── kevin-wong-tt7aK2yV7xo-unsplash.jpg ├── nathan-anderson-7TGVEgcTKlY-unsplash.jpg ├── photo-1434907652076-85f8401482c3.jpg ├── photo-1510272839903-5112a2e44bc6.jpg ├── photo-1521579971123-1192931a1452.jpg ├── samuele-errico-piccarini-t4OxCpKie70-unsplash.jpg └── valentin-salja-VMroCCpP648-unsplash.jpg ``` -------------------------------- ### f2 Environmental Variables Reference Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/reference/cli-options.md Reference for environmental variables that can configure the f2 file renaming tool. ```APIDOC Environment Variable: F2_DEFAULT_OPTS Description: Override the default options according to your preferences. Environment Variable: F2_NO_COLOR, NO_COLOR Description: Set to any value to disable coloured output. ``` -------------------------------- ### F2 Basic Find and Replace Using Regex Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This snippet shows a basic find and replace operation where multiple spaces are replaced with a single underscore. By default, arguments to the `-f` flag are interpreted as regular expressions, allowing for flexible pattern matching like `[ ]{1,}` to match one or more spaces. ```bash f2 -f '[ ]{1,}' -r '_' ``` -------------------------------- ### Recursively Rename Files with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md Demonstrates how to recursively replace 'js' with 'ts' in filenames across all subdirectories using the `f2` command with the `-R` option. ```bash f2 -f 'js' -r 'ts' -R ``` -------------------------------- ### Rename Files Matching Extension with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md Shows the default behavior of `f2` where the file extension is considered during renaming, replacing 'jpeg' with 'jpg'. ```bash f2 -f 'jpeg' -r 'jpg' ``` -------------------------------- ### Rename Webp Files with Sequential Numbering using F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This command renames all files ending with '.webp' by replacing their base name with a three-digit sequential number, preserving the original '.webp' extension. It demonstrates a basic find and replace operation with f2. ```bash f2 -f '.*\.webp' -r '%03d{ext}' ``` ```text ┌───────────────────────────────────────────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | ***************************************************************** | | 34e7dcd7.webp | 001.webp | ok | | 3a2107b350fe4173f09a38deebd715bc.webp | 002.webp | ok | | 7ukau2yqm8y91.webp | 003.webp | ok | | 7zwffegy91871.webp | 004.webp | ok | | 9ru90wxqm8y91.webp | 005.webp | ok | | alan_p.webp | 006.webp | ok | | bgtqgsxqm8y91.webp | 007.webp | ok | | dashboard5.webp | 008.webp | ok | | eiuz4tzc2le71.webp | 009.webp | ok | | image-2-1.webp | 010.webp | ok | | qeila4tnvr971.webp | 011.webp | ok | | sa3a4zxqm8y91.webp | 012.webp | ok | └───────────────────────────────────────────────────────────────────┘ ``` -------------------------------- ### F2 Find and Replace with Escaped Regex Characters Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This example demonstrates how to rename files containing regex special characters by escaping them with a backslash. It shows replacing the literal string '(2021)' with '[2022]', ensuring that the parentheses are treated as part of the search string rather than regex grouping characters. ```bash f2 -f '\(2021\)' -r '[2022]' ``` -------------------------------- ### Chaining Multiple Renaming Operations with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This command demonstrates how to chain multiple `-f` (find) and `-r` (replace) flags in a single F2 command to perform complex file renaming. It first extracts game title and region, then processes the title further by uppercasing a specific part and enclosing it in parentheses, yielding an intermediate result before the final transformation. ```bash f2 -f '[^a-zA-Z]*([^(]*) \\(([^)]*)\\).*\\.iso$' -r 'Games/$2/$1{ext}' -f ' - ([^.]*)' -r ' ({<$1>.up})' ``` -------------------------------- ### Output of F2 Command for Date-Based Reorganization Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md Displays the result of the `f2` command, showing how original file paths are transformed into the new date-based directory structure. This output includes the status of each file operation, indicating successful reorganization. ```text ——————————————————*————————* | ORIGINAL | RENAMED | STATUS | *———————————————————————————————————*——————————————————————————————————————————————————————————*————————* | _DSC0560.ARW | 2024/06-Jun/2024-06-28/_DSC0560.ARW | ok | | _DSC0560.JPG | 2024/06-Jun/2024-06-28/_DSC0560.JPG | ok | | _DSC0561.ARW | 2024/06-Jun/2024-06-28/_DSC0561.ARW | ok | | _DSC0561.JPG | 2024/06-Jun/2024-06-28/_DSC0561.JPG | ok | | birthday-2024/_DSC0430.ARW | birthday-2024/2024/06-Jun/2024-06-28/_DSC0430.ARW | ok | | birthday-2024/_DSC0430.JPG | birthday-2024/2024/06-Jun/2024-06-28/_DSC0430.JPG | ok | | birthday-2024/_DSC0431.ARW | birthday-2024/2024/06-Jun/2024-06-28/_DSC0431.ARW | ok | | birthday-2024/_DSC0431.JPG | birthday-2024/2024/06-Jun/2024-06-28/_DSC0431.JPG | ok | | family trip - berlin/_DSC1767.ARW | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1767.ARW | ok | | family trip - berlin/_DSC1767.JPG | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1767.JPG | ok | | family trip - berlin/_DSC1769.ARW | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1769.ARW | ok | | family trip - berlin/_DSC1769.JPG | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1769.JPG | ok | | family trip - berlin/_DSC1770.ARW | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1770.ARW | ok | | family trip - berlin/_DSC1770.JPG | family trip - berlin/2024/06-Jun/2024-06-27/_DSC1770.JPG | ok | | family trip - london/_DSC0090.ARW | family trip - london/2024/05-May/2024-05-30/_DSC0090.ARW | ok | | family trip - london/_DSC0090.JPG | family trip - london/2024/05-May/2024-05-30/_DSC0090.JPG | ok | | family trip - london/_DSC0091.ARW | family trip - london/2024/05-May/2024-05-30/_DSC0091.ARW | ok | | family trip - london/_DSC0091.JPG | family trip - london/2024/05-May/2024-05-30/_DSC0091.JPG | ok | | my-wedding/DSC05194.ARW | my-wedding/2024/07-Jul/2024-07-02/DSC05194.ARW | ok | | my-wedding/DSC05194.JPG | my-wedding/2024/07-Jul/2024-07-02/DSC05194.JPG | ok | | my-wedding/DSC05195.ARW | my-wedding/2024/07-Jul/2024-07-02/DSC05195.ARW | ok | | my-wedding/DSC05195.JPG | my-wedding/2024/07-Jul/2024-07-02/DSC05195.JPG | ok | *———————————————————————————————————*——————————————————————————————————————————————————————————*————————* ``` -------------------------------- ### Rename Files Excluding Directories with F2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md Illustrates the default behavior of `f2` where directories are exempted from renaming, showing how to replace 'pic' with 'image' in filenames. ```bash f2 -f 'pic' -r 'image' ``` -------------------------------- ### Perform Case-Insensitive Renaming with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This snippet demonstrates how to make `f2` case-insensitive during file renaming operations. By default, `f2` is case-sensitive, but the `-i/--ignore-case` flag allows it to match patterns regardless of letter casing. The example shows converting various 'jpeg' extensions to 'jpg' without regard for case. ```bash f2 -f 'jpeg' -r 'jpg' -i ``` ```text ┌─────────────────────────────┐ | ORIGINAL | RENAMED | STATUS | | *************************** | | a.JPEG | a.jpg | ok | | b.jpeg | b.jpg | ok | | c.jPEg | c.jpg | ok | └─────────────────────────────┘ ``` -------------------------------- ### Directory Structure After Partial Renaming Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/recovering-from-failures.md Displays the directory structure after the F2 renaming attempt. It shows that some files were successfully renamed according to the pattern, while the immutable files remained unchanged, demonstrating F2's partial success handling. ```text ├── kevin-wong-tt7aK2yV7xo-unsplash.jpg ├── nathan-anderson-7TGVEgcTKlY-unsplash.jpg ├── unsplash-image-003.jpg ├── unsplash-image-004.jpg ├── unsplash-image-005.jpg ├── unsplash-image-006.jpg └── valentin-salja-VMroCCpP648-unsplash.jpg ``` -------------------------------- ### Change File Directory Structure with f2 Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/tutorial.md This snippet illustrates how `f2` can be used to not only rename files but also to reorganize them into new directory structures. By including path separators (`/` or `\`) in the replacement string, `f2` automatically creates necessary directories and moves files, enabling categorization into subfolders based on extracted filename elements. ```bash f2 -f '[^a-zA-Z]*([^(]*) \(([^)]*)\).*\.iso$' -r 'Games/$2/$1{ext}' ``` -------------------------------- ### Output of f2 Renaming with Paired Index Source: https://github.com/ayoisaiah/f2-docs/blob/master/docs/guide/organizing-image-library.md This table shows the result of the `f2` command when the `--pair` option is used. It demonstrates how files like ARW and JPG, which are typically paired, are renamed with the same sequential number within their respective date-based folders, thus preserving their association. The output is truncated but clearly indicates the intended behavior. ```text *———————————————————————————————————*————————————————————————————————*————————* ```