How about sharing your CLI scripts?
How about sharing your CLI scripts?
FileBot has introduced it's own integrated Groovy script engine so you can easily script things and then share that with people on any platform. So if you have come up with some nice scripts, why not share them with people here?
Scripts and change logs are available on GitHub:
https://github.com/filebot/scripts
Scripts listed here can easily be called via -script fn:name. FileBot will automatically fetch and cache the script repository.
You can use -script dev:name to use the latest script from the development branch directly from GitHub.
Scripts and change logs are available on GitHub:
https://github.com/filebot/scripts
Scripts listed here can easily be called via -script fn:name. FileBot will automatically fetch and cache the script repository.
You can use -script dev:name to use the latest script from the development branch directly from GitHub.
Please read the FAQ and How to Request Help.
Media Index TSV
Description:
Write media info of all video files in the given folder to an easily readable TSV spreadsheet file.
Export media info for all files to a *.tsv file:
Write media info of all video files in the given folder to an easily readable TSV spreadsheet file.
Export media info for all files to a *.tsv file:
Shell: Select all
filebot -script fn:mi /path/to/media --output /path/to/media-index.tsv
Please read the FAQ and How to Request Help.
Fetch artwork and NFO files
Description:
Fetch artwork for your movie folders, series folders and season folders from TheMovieDB or TheTVDB and generate movie and series *.nfo files.
Fetch movie artwork:
Fetch series artwork:
Options:
--q name force series or movie name (i.e. disable auto-detection)
-non-strict force non-interactive mode (default on headless machines)
Notes:
Fetch artwork for your movie folders, series folders and season folders from TheMovieDB or TheTVDB and generate movie and series *.nfo files.
Fetch movie artwork:
Shell: Select all
filebot -script fn:artwork.tmdb "/path/to/Movies"
Shell: Select all
filebot -script fn:artwork.tvdb "/path/to/TV Shows"
--q name force series or movie name (i.e. disable auto-detection)
-non-strict force non-interactive mode (default on headless machines)
Notes:
- Episodes are expected to be organized into a standard {plex} file and folder structure already. The movie or TV series may be auto-detected from the file and the folder structure if Metadata and Extended Attributes are not available.
Please read the FAQ and How to Request Help.
Fetch artwork and NFO files (v2)
Description:
Fetch artwork and generate *.nfo files for movie folders, series folders, season folders and episode files.
Fetch artwork:
Generate NFO files:
Notes:
Fetch artwork and generate *.nfo files for movie folders, series folders, season folders and episode files.
Fetch artwork:
Shell: Select all
filebot -script fn:artwork /path/to/media/
Shell: Select all
filebot -script fn:nfo /path/to/media/
- This script does not parse or guess any information from the filename. Files that do not have xattr metadata will be ignored.
- This script will fetch artwork and movie / series information from the database that was used when renaming the files as per xattr metadata.
Please read the FAQ and How to Request Help.
The Cleaner
Description:
Delete clutter files like artwork, samples, etc in folders that have been left over after moving video files, but do not touch any file in any folder where there is at least one video file (that is larger than --def minsize) remaining.
Delete left-behind clutter files:
Options:
--action test only print files that would be deleted, but don't actually do anything
--def root=y Delete given folder as well if left empty
Advanced Options:
--def exts=pattern override default pattern for what extensions will be cleansed
--def terms=pattern override default pattern for for what paths will be cleansed
--def ignore=pattern paths that match this pattern will never be considered as clutter or deleted
--def minsize=bytes files smaller than minsize will be deleted as clutter regardless of extension (20 MB by default)
--def maxsize=bytes files larger than maxsize will never be deleted (120 MB by default)
Delete clutter files like artwork, samples, etc in folders that have been left over after moving video files, but do not touch any file in any folder where there is at least one video file (that is larger than --def minsize) remaining.
Delete left-behind clutter files:
Shell: Select all
filebot -script fn:cleaner /path/to/media/
--action test only print files that would be deleted, but don't actually do anything
--def root=y Delete given folder as well if left empty
Advanced Options:
--def exts=pattern override default pattern for what extensions will be cleansed
--def terms=pattern override default pattern for for what paths will be cleansed
--def ignore=pattern paths that match this pattern will never be considered as clutter or deleted
--def minsize=bytes files smaller than minsize will be deleted as clutter regardless of extension (20 MB by default)
--def maxsize=bytes files larger than maxsize will never be deleted (120 MB by default)
Please read the FAQ and How to Request Help.
Query Rename History
Description:
FileBot keeps an internal history of all rename operations in case you want to revert files to their original names or just want to find out the original name of a given file.
Print the entire rename history:
Print rename history for the given files or folders:
Options:
-mediainfo <options> perform -mediainfo command on duplicate files
-rename <options> perform -rename command on duplicate files
FileBot keeps an internal history of all rename operations in case you want to revert files to their original names or just want to find out the original name of a given file.
Print the entire rename history:
Shell: Select all
filebot -script fn:history
Shell: Select all
filebot -script fn:history "/path/to/files"
Options:
-mediainfo <options> perform -mediainfo command on duplicate files
-rename <options> perform -rename command on duplicate files
Please read the FAQ and How to Request Help.
View or Clear Extended Attributes
Description:
If extended attributes are enabled and supported on your platform and filesystem FileBot will store original filename and episode/movie metadata into extended attributes for future reference by FileBot or other applications. This script allows you to view and clear these extended attributes.
View xattr for files:
Clear xattr from files:
Prune orphaned .xattr folders where the corresponding media file no longer exists:
Reverse rename previously renamed files to their original filenames based on original filename xattr:
View FileBot xattr metadata in json format:
Options:
--action clear Clear xattr metadata
--action prune Delete orphaned .xattr folders
--action import Import xattr metadata into macOS Finder tags
If extended attributes are enabled and supported on your platform and filesystem FileBot will store original filename and episode/movie metadata into extended attributes for future reference by FileBot or other applications. This script allows you to view and clear these extended attributes.
View xattr for files:
Shell: Select all
filebot -script fn:xattr /path/to/files
Shell: Select all
filebot -script fn:xattr /path/to/files --action clear
Shell: Select all
filebot -script fn:xattr /path/to/files --action prune
Shell: Select all
filebot -rename -r /path/to/files --db xattr --format "{original}"
Shell: Select all
filebot -mediainfo -r /path/to/files --format "{json}"
--action clear Clear xattr metadata
--action prune Delete orphaned .xattr folders
--action import Import xattr metadata into macOS Finder tags
Please read the FAQ and How to Request Help.
Fetch subtitles for all files
Description:
If you want to fetch subtitles for more than just a single folder then a simple filebot -get-subtitles -r call with many file arguments (see CLI) can be a bad idea. This script will fetch subtitles folder per folder to make fetching large amounts of subtitles more reliable. Files may be included or excluded based on file creation date, last modified date, file size, video length, embedded subtitles, etc
Fetch subtitles for all recently created files that are not too new and not to old:
Fetch subtitles for all recently created files:
You must not lookup subtitles for all files repeatedly in any kind of automated setup, or you will get banned. If you use the suball script in an automated setup then you MUST SET --def maxAgeDays to 30 days or less.
Files will be ignored and excluded from processing if one of the following conditions holds true:
Options:
--lang zho set preferred subtitle language (default: eng)
-non-strict enable Fuzzy Search (default: Exact Search)
--def maxAgeDays=7 set a max-age for files that will be processed, older files will be ignored (default: 30)
--def minAgeDays=1 set a min-age for files that will be processed, newer files will be ignored (so better subtitles can be downloaded later)
--def minFileSize=0 set a minimum file size, smaller files will be ignored (default: 50 MB)
--def minLengthMS=0 set a minimum video duration, shorter videos will be ignored (default: 10 min)
--def ignore=regex set an ignore pattern for paths that should be ignored
--def ignoreTextLanguage=regex set an ignore pattern for video files that already contain embedded subtitles in certain languages (default: en)
If you want to fetch subtitles for more than just a single folder then a simple filebot -get-subtitles -r call with many file arguments (see CLI) can be a bad idea. This script will fetch subtitles folder per folder to make fetching large amounts of subtitles more reliable. Files may be included or excluded based on file creation date, last modified date, file size, video length, embedded subtitles, etc
Fetch subtitles for all recently created files that are not too new and not to old:
Shell: Select all
filebot -script fn:suball /path/to/media -non-strict --def minAgeDays=1 maxAgeDays=7
Fetch subtitles for all recently created files:
You must not lookup subtitles for all files repeatedly in any kind of automated setup, or you will get banned. If you use the suball script in an automated setup then you MUST SET --def maxAgeDays to 30 days or less.
Shell: Select all
filebot -script fn:suball /path/to/media
Files will be ignored and excluded from processing if one of the following conditions holds true:
- file path matches your --def ignore pattern
- time passed since file last-modified date is more than --def maxAgeDays
- time passed since file last-modified date is less than --def minAgeDays
- file size is less than --def minFileSize
- video duration is less than --def minLengthMS
- video file already contains embedded subtitles in a language matching your --def ignoreTextLanguage pattern (by default no additional subtitles are fetched if there already are embedded subtitles of any language)
Options:
--lang zho set preferred subtitle language (default: eng)
-non-strict enable Fuzzy Search (default: Exact Search)
--def maxAgeDays=7 set a max-age for files that will be processed, older files will be ignored (default: 30)
--def minAgeDays=1 set a min-age for files that will be processed, newer files will be ignored (so better subtitles can be downloaded later)
--def minFileSize=0 set a minimum file size, smaller files will be ignored (default: 50 MB)
--def minLengthMS=0 set a minimum video duration, shorter videos will be ignored (default: 10 min)
--def ignore=regex set an ignore pattern for paths that should be ignored
--def ignoreTextLanguage=regex set an ignore pattern for video files that already contain embedded subtitles in certain languages (default: en)
Please read the FAQ and How to Request Help.
Verify File Integrity
Description:
This script can be used to verify file integrity over time. On the first run the CRC32 checksum will be stored as xattr metadata. In subsequent runs the original checksum can then be compared to the actual checksum.
Calculate CRC32 and compare it to the previously stored checksum:
Options:
--log warning print only important output (such as when a CRC32 mismatch is found, or CRC32 metadata is initialized for the first time)
Notes:
This script can be used to verify file integrity over time. On the first run the CRC32 checksum will be stored as xattr metadata. In subsequent runs the original checksum can then be compared to the actual checksum.
Calculate CRC32 and compare it to the previously stored checksum:
Shell: Select all
filebot -script fn:verify /path/to/files
--log warning print only important output (such as when a CRC32 mismatch is found, or CRC32 metadata is initialized for the first time)
Notes:
- The initially computed CRC32 checksum will be stored as text value in the xattr field "CRC32" so the checksum will also be instantly available when using {crc32} in the format.
Please read the FAQ and How to Request Help.
Find missing Episodes
Description:
Finding missing episodes is easy once all your content has been renamed and xattr tagged with FileBot. This script will cross-check your files with the online episode data and tell you which episodes are missing.
Find missing episodes:
Options:
--log OFF print only missing episodes
Notes:
Finding missing episodes is easy once all your content has been renamed and xattr tagged with FileBot. This script will cross-check your files with the online episode data and tell you which episodes are missing.
Find missing episodes:
Shell: Select all
filebot -script fn:miss /path/to/media
--log OFF print only missing episodes
Notes:
- This script does not parse or guess any information from the filename. Files that do not have xattr metadata will be ignored.
- This script additionally checks for changes in metadata where previously stored xattr metadata does not exactly match current online episode metadata. (e.g. find files where the episode title was changed in the online database)
Please read the FAQ and How to Request Help.
Find Duplicate Movie or Episode Files
Description:
Finding duplicate movie or episode files is easy once all your content has been renamed and xattr tagged with FileBot. This script allows you to view or delete duplicates.
List Logical Duplicates:
There are logical duplicates when multiple files refer to the same movie or episode (e.g. 720p, and 1080p and 4K versions of the same movie or episode).
List Logical Duplicates per Video Format:
There are logical duplicates per video format when multiple files refer to the same movie or episode and have the same video format (e.g. multiple 1080p versions of the same movie or episode).
List Binary Duplicates:
There are binary duplicates when multiple files are identical byte for byte (i.e. copies of the same file).
Print Total File Size of Binary Duplicates:
Options:
--action delete delete duplicate files
-non-strict allow one logical duplicate per video format
-rename <options> perform -rename command on duplicate files
-mediainfo <options> perform -mediainfo command on duplicate files
-exec <command> perform -exec command on duplicate files
Advanced Options:
--order input sort duplicates by input argument order (default in --mode binary)
--order quality sort duplicates by highest quality first (default in --mode logical)
--order date sort duplicates by least recently created (according to Media Encoding Date or File Creation Date)
--order time sort duplicates by least recently modified (according to File Last-Modified Date)
Notes:
Finding duplicate movie or episode files is easy once all your content has been renamed and xattr tagged with FileBot. This script allows you to view or delete duplicates.
List Logical Duplicates:
Shell: Select all
filebot -script fn:duplicates /path/to/files
List Logical Duplicates per Video Format:
Shell: Select all
filebot -script fn:duplicates -non-strict /path/to/files
List Binary Duplicates:
Shell: Select all
filebot -script fn:duplicates --mode binary /input /output /backup
Print Total File Size of Binary Duplicates:
Shell: Select all
filebot -script fn:duplicates --mode binary /path/to/files -exec du -ch {f} +
Options:
--action delete delete duplicate files
-non-strict allow one logical duplicate per video format
-rename <options> perform -rename command on duplicate files
-mediainfo <options> perform -mediainfo command on duplicate files
-exec <command> perform -exec command on duplicate files
Advanced Options:
--order input sort duplicates by input argument order (default in --mode binary)
--order quality sort duplicates by highest quality first (default in --mode logical)
--order date sort duplicates by least recently created (according to Media Encoding Date or File Creation Date)
--order time sort duplicates by least recently modified (according to File Last-Modified Date)
Notes:
- In --mode logical, as per --order quality, the --action delete option will keep only the one file with the highest video quality.
- In --mode logical, this script will not parse or guess any information from the filename. Files that do not have xattr metadata will be ignored. Please read the addendum for details.
- In --mode binary, as per --order input, the --action delete option will keep only the first occurrence of a file according to the input argument order.
- In --mode binary, this script may read files partially or entirely to compute checksums, which are then stored as xattr to speed up subsequent runs.
Please read the FAQ and How to Request Help.
Write Embedded Tags
Description:
Write embedded mp4 and mkv tags to the file content based on existing xattr metadata.
Write Embedded Tags:
Beware! You are modifying files! Proceed with caution!
Be aware of symlinks and hardlinks (i.e. one file accessible via multiple different file paths) when modifying file contents.
Notes:
Write embedded mp4 and mkv tags to the file content based on existing xattr metadata.
Write Embedded Tags:
Shell: Select all
filebot -script fn:tags /path/to/files
Be aware of symlinks and hardlinks (i.e. one file accessible via multiple different file paths) when modifying file contents.
Notes:
- This script requires the mkvpropedit (i.e. mkvtoolnix package) and AtomicParsley (i.e. atomicparsley package) command-line tools to write embedded mkv and mp4 tags. If mkvpropedit or AtomicParsley are not in the $PATH then you can specify the absolute path to the executable via the --def mkvpropedit and --def atomicparsley script parameters:
Shell: Select all
--def mkvpropedit="C:/Tools/mkvpropedit.exe" --def atomicparsley="C:/Tools/AtomicParsley.exe"
- This script will not parse or guess information from the filename. Files that do not have xattr metadata will be ignored.
- Embedded MP4 or MKV tags are rare an uncommon. There is no established standard for tagging video files. MP4 tagging usually (but not necessarily) refers to iTunes-style metadata. MKV tagging (1, 2) is generally useless because the media player you use (i.e. Plex, Emby, Kodi, etc) likely doesn't use mkv metadata, other than the media title property. Please read the tags script for details.
Please read the FAQ and How to Request Help.
Export selected files as ZIP archive
Description:
Pack selected files into a new zip archive.
Select *.nfo and *.url files and pack them into a new zip archive:
Select *.log files from a specific year and pack them into a new zip archive:
Export filebot cache for debugging purposes:
Options:
-d retain directory structure (i.e. remove -d to flatten the zip file structure)
Pack selected files into a new zip archive.
Select *.nfo and *.url files and pack them into a new zip archive:
Shell: Select all
filebot -script fn:zip -d /path/to/files --filter "ext =~ /nfo|url/" --output "Companion Files.zip"
Shell: Select all
filebot -script fn:zip -d /path/to/files --filter "ext =~ /log/ && f.lastModified().toDate(/UTC/).year == 2021" --output "Logs 2021.zip"
Shell: Select all
filebot -script fn:zip -d "%APPDATA%/FileBot" --filter "f =~ /cache/" --output "%USERPROFILE%/Desktop/FileBot Cache.zip"
-d retain directory structure (i.e. remove -d to flatten the zip file structure)
Please read the FAQ and How to Request Help.