├── .assets └── screenshot.png ├── .gitignore ├── .helper-scripts ├── multiselect-menu.sh └── unit-tests.sh ├── Archive ├── Compress to '7z' (each) ├── Compress to '7z' with password (each) ├── Compress to 'iso' (each) ├── Compress to 'squashfs' (each) ├── Compress to 'tar.gz' (each) ├── Compress to 'tar.xz' (each) ├── Compress to 'tar.zst' (each) ├── Compress to 'zip' (each) ├── Compress... └── Extract Here ├── Clipboard operations ├── Copy filename to clipboard ├── Copy filename to clipboard (recursive) ├── Copy filepath to clipboard ├── Copy filepath to clipboard (recursive) ├── Download URLs from clipboard ├── Paste from clipboard as a file ├── Replace with copied file └── Replace with copied file (hard link) ├── Directories and files ├── Compare items ├── Compare items (via diff) ├── Flatten directory structure ├── List duplicate files ├── List empty directories ├── List file information ├── List file information (via ExifTool) ├── List file information (via MediaInfo) ├── List file mime ├── List hidden items ├── List item properties ├── List largest directories ├── List largest files ├── List permissions and owners ├── List recently modified files ├── Open item location └── Reset permissions (recursive) ├── Document ├── Convert documents │ ├── Convert to 'docx' │ ├── Convert to 'epub' │ ├── Convert to 'fb2' │ ├── Convert to 'markdown' │ ├── Convert to 'odp' │ ├── Convert to 'ods' │ ├── Convert to 'odt' │ ├── Convert to 'pdf' │ ├── Convert to 'pptx' │ ├── Convert to 'txt' │ └── Convert to 'xlsx' ├── PDF combine, split │ ├── Combine multiple PDFs │ └── Split into single-page PDFs ├── PDF encrypt, decrypt │ ├── Decrypt (remove password) │ ├── Decrypt (remove restrictions) │ ├── Encrypt (set a password) │ └── List encrypted PDFs ├── PDF multiple-page layout │ ├── 2 pages per sheet (1x2, landscape) │ ├── 2 pages per sheet (1x2, portrait) │ ├── 2 pages per sheet (2x1, landscape) │ ├── 2 pages per sheet (2x1, portrait) │ ├── 4 pages per sheet (2x2, landscape) │ ├── 4 pages per sheet (2x2, portrait) │ ├── 8 pages per sheet (2x4, landscape) │ ├── 8 pages per sheet (2x4, portrait) │ ├── 8 pages per sheet (4x2, landscape) │ └── 8 pages per sheet (4x2, portrait) ├── PDF optimize, shrink │ ├── List non-linearized PDFs │ ├── Optimize for web (linearize) │ ├── Reduce resolution (150 dpi, e-book) │ └── Reduce resolution (300 dpi, printer) ├── PDF paper size │ ├── Paper size to A3 │ ├── Paper size to A4 │ ├── Paper size to A5 │ ├── Paper size to US Legal │ └── Paper size to US Letter ├── PDF rotate │ ├── PDF Rotate (180 deg) │ ├── PDF Rotate (270 deg) │ └── PDF Rotate (90 deg) ├── PDF text recognition (OCR) │ ├── List non-searchable PDFs │ ├── Perform OCR (English) │ ├── Perform OCR (French) │ ├── Perform OCR (German) │ ├── Perform OCR (Italian) │ ├── Perform OCR (Portuguese) │ ├── Perform OCR (Russian) │ └── Perform OCR (Spanish) ├── PDF tools │ ├── Add PDF watermark (overlay) │ ├── Add PDF watermark (underlay) │ ├── Convert to 'PDFA-2b' │ ├── Extract images │ ├── List annotated PDFs │ ├── List digitally signed PDFs │ ├── List signatures information │ ├── Remove PDF annotations │ └── Remove PDF metadata (via ExifTool) └── Print documents │ ├── Print (paper size A4) │ ├── Print (paper size US Legal) │ └── Print (paper size US Letter) ├── File encryption ├── GPG Decrypt ├── GPG Encrypt with password ├── GPG Encrypt with password (ASCII) ├── GPG Encrypt with public keys ├── GPG Encrypt with public keys (ASCII) ├── GPG Import key ├── GPG Sign ├── GPG Sign (ASCII) ├── GPG Sign (detached signature) └── GPG Verify signature ├── Hash and checksum ├── List CRC32 ├── List MD5 ├── List SHA-1 ├── List SHA-256 ├── List SHA-512 ├── List all file hashes ├── Produce 'md5sum.txt' ├── Produce 'sha1sum.txt' ├── Produce 'sha256sum.txt' ├── Produce 'sha512sum.txt' ├── Verify 'md5sum.txt' ├── Verify 'sha1sum.txt' ├── Verify 'sha256sum.txt' └── Verify 'sha512sum.txt' ├── Image ├── Color operations │ ├── Colorspace to Gray │ ├── Desaturate (average) │ ├── Desaturate (luma) │ └── Generate images with multiple hues ├── Combine, split │ ├── Combine images into a 'gif' │ ├── Combine images into a 'pdf' │ ├── Split into 2 parts (horizontally) │ ├── Split into 2 parts (vertically) │ ├── Split into 4 parts │ ├── Stack images (horizontally) │ └── Stack images (vertically) ├── Convert │ ├── Convert to 'avif' │ ├── Convert to 'bmp' │ ├── Convert to 'gif' │ ├── Convert to 'jpg' │ ├── Convert to 'png' │ ├── Convert to 'tif' │ ├── Convert to 'webp' │ └── Export to 'pdf' ├── Create icon │ ├── Create 'png' icon (128 px) │ ├── Create 'png' icon (256 px) │ ├── Create 'png' icon (512 px) │ └── Create 'png' icon (64 px) ├── Crop, resize │ ├── Automatic crop │ ├── Automatic crop (15 pct) │ ├── Resize (25 pct) │ ├── Resize (50 pct) │ ├── Resize (75 pct) │ └── Resize and crop (1920x1080) ├── Flip, rotate │ ├── Flip (horizontally) │ ├── Flip (vertically) │ ├── Rotate (180 deg) │ ├── Rotate (270 deg) │ └── Rotate (90 deg) ├── Image similarity │ ├── Find similar images (65 pct) │ ├── Find similar images (75 pct) │ ├── Find similar images (85 pct) │ └── Find similar images (95 pct) ├── Optimize │ ├── Optimize 'png' images │ └── Remove metadata (via ExifTool) ├── SVG files │ ├── Convert 'svg' to 'svgz' (compress) │ ├── Convert 'svgz' to 'svg' (decompress) │ ├── Export 'svg' to 'eps' │ ├── Export 'svg' to 'pdf' │ ├── Export 'svg' to 'png' (1024 px) │ ├── Export 'svg' to 'png' (256 px) │ ├── Export 'svg' to 'png' (512 px) │ ├── Replace fonts to 'Charter' │ ├── Replace fonts to 'Helvetica' │ └── Replace fonts to 'Times' ├── Text recognition (OCR) │ ├── Image OCR (English) │ ├── Image OCR (French) │ ├── Image OCR (German) │ ├── Image OCR (Italian) │ ├── Image OCR (Portuguese) │ ├── Image OCR (Russian) │ └── Image OCR (Spanish) ├── Transparency │ ├── Background to alpha │ ├── Background to alpha (15 pct) │ ├── Replace alpha with black │ ├── Replace alpha with magenta │ ├── Replace alpha with white │ ├── Replace black with alpha │ ├── Replace black with alpha (15 pct) │ ├── Replace magenta with alpha │ ├── Replace magenta with alpha (15 pct) │ ├── Replace white with alpha │ └── Replace white with alpha (15 pct) └── Watermark │ ├── Add watermark (center) │ ├── Add watermark (north) │ ├── Add watermark (northeast) │ ├── Add watermark (northwest) │ ├── Add watermark (south) │ ├── Add watermark (southeast) │ └── Add watermark (southwest) ├── LICENSE.txt ├── Link operations ├── Create hard link here ├── Create hard link to... ├── Create symbolic link here ├── Create symbolic link to... ├── List broken links ├── List hard links ├── List symbolic links ├── Paste as hard link └── Paste as symbolic link ├── Multimedia ├── Audio convert │ ├── Convert to 'flac' │ ├── Convert to 'mp3' (192 kbps) │ ├── Convert to 'mp3' (320 kbps) │ ├── Convert to 'mp3' (48 kbps, mono) │ ├── Convert to 'ogg' (192 kbps) │ ├── Convert to 'ogg' (320 kbps) │ ├── Convert to 'ogg' (48 kbps, mono) │ ├── Convert to 'opus' (192 kbps, VBR) │ ├── Convert to 'opus' (320 kbps, VBR) │ ├── Convert to 'opus' (48 kbps, mono, VBR) │ └── Convert to 'wav' ├── Audio effects │ ├── Fade in │ ├── Fade out │ ├── Normalize │ ├── Remove silent sections (below -30 dB) │ └── Silence noise (below -30 dB) ├── Audio tools │ ├── Concatenate files ('wav' output) │ ├── List audio quality │ ├── Mix channels to mono │ ├── Mix two files ('wav' output) │ ├── Produce a spectrogram │ └── Remove metadata (recursive) ├── MP3 files │ ├── List ID3 tags │ ├── List MP3 information │ ├── Maximize gain (recursive) │ ├── Normalize gain (recursive) │ ├── Repair (recursive) │ ├── Tag ID3 to filename (artist - title) │ └── Tag filename to ID3 (artist - title) ├── Video audio track │ ├── Extract audio │ └── Remove audio ├── Video convert │ ├── Convert to 'mkv' │ ├── Convert to 'mkv' (no re-encoding) │ ├── Convert to 'mp4' │ ├── Convert to 'mp4' (no re-encoding) │ └── Export to 'gif' ├── Video frame rate │ ├── Frame rate to 30 FPS │ └── Frame rate to 60 FPS ├── Video resize │ ├── Resize video (25 pct) │ ├── Resize video (50 pct) │ └── Resize video (75 pct) ├── Video speed factor │ ├── Speed factor to 0.5 │ ├── Speed factor to 1.5 │ └── Speed factor to 2.0 └── Video tools │ ├── Concatenate videos ('mp4' output) │ ├── Export frames (1 FPS) │ ├── Export frames (10 FPS) │ ├── Export frames (5 FPS) │ └── Remove metadata ├── Open with ├── Code Editor ├── Disk Usage Analyzer └── Terminal ├── Programming ├── Git │ ├── Git clean │ ├── Git clone URLs from clipboard │ ├── Git fetch │ ├── Git gc │ ├── Git init │ ├── Git pull │ ├── Git reset full │ ├── List Git branches │ ├── List Git log │ ├── List Git status │ ├── List Git tags │ └── Open repository website ├── Text encodings │ ├── Encode to ISO-8859-1 │ ├── Encode to UTF-8 │ ├── List encodings │ └── Transliterate to ASCII ├── Text indentation │ ├── Convert '4 spaces' to 'tabs' │ ├── Convert '8 spaces' to 'tabs' │ ├── Convert 'tabs' to '4 spaces' │ └── Convert 'tabs' to '8 spaces' ├── Text line breaks │ ├── Line breaks to CRLF (Windows) │ ├── Line breaks to LF (Unix) │ └── List line breaks ├── Text repair │ ├── Convert to UTF-8 with CRLF (recursive) │ ├── Convert to UTF-8 with LF (recursive) │ ├── List files issues │ ├── List files with bad chars │ └── Remove trailing spaces ├── Text statistics │ ├── List lines count │ ├── List max line length │ └── List words count └── Text tools │ └── Concatenate multiple files ├── README.md ├── Rename files ├── Remove accents (translit.) ├── Remove brackets ├── Rename to lowercase ├── Rename to lowercase (recursive) ├── Rename to sentence case ├── Rename to title case ├── Rename to uppercase ├── Rename to uppercase (recursive) ├── Replace gaps with dashes ├── Replace gaps with spaces └── Replace gaps with underscores ├── Security and recovery ├── File carving (via Foremost) ├── File carving (via PhotoRec) ├── Permanently delete files (shred) └── Scan for malware (via ClamAV) ├── common-functions.sh └── install.sh /.assets/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cfgnunes/nautilus-scripts/3f35a72171a878493fbaa3b2b931d3a68fb91b60/.assets/screenshot.png -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Backup files. 2 | *.bak 3 | 4 | # Log files. 5 | *.log 6 | 7 | # Output dirs. 8 | Output*/ 9 | 10 | # Some scripts directories. 11 | Accessed recently/ 12 | User previous scripts/ 13 | -------------------------------------------------------------------------------- /Archive/Compress to 'squashfs' (each): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=mksquashfs; pkg_manager=apt; package=squashfs-tools | 15 | command=mksquashfs; pkg_manager=dnf; package=squashfs-tools | 16 | command=mksquashfs; pkg_manager=pacman; package=squashfs-tools | 17 | command=mksquashfs; pkg_manager=zypper; package=squashfs" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=all; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=squashfs") 35 | std_output=$(mksquashfs "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Archive/Compress...: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=C 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | 12 | # Execute initial checks. 13 | input_files=$(_get_files "par_type=all") 14 | 15 | # Run the main process. 16 | # shellcheck disable=SC2086 17 | if _command_exists "file-roller"; then 18 | file-roller --add -- $input_files & 19 | elif _command_exists "ark"; then 20 | ark --add --dialog -- $input_files & 21 | elif _command_exists "engrampa"; then 22 | engrampa --add -- $input_files & 23 | elif _command_exists "lxqt-archiver"; then 24 | lxqt-archiver --add -- $input_files & 25 | elif _command_exists "arqiver"; then 26 | arqiver --sa $input_files & 27 | elif _command_exists "xarchiver"; then 28 | xarchiver --compress=$input_files & 29 | else 30 | _check_dependencies "command=file-roller" 31 | file-roller --add -- $input_files & 32 | fi 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Clipboard operations/Copy filename to clipboard: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local output_dir="" 10 | 11 | # Execute initial checks. 12 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 13 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 14 | _check_dependencies "command=wl-copy; package=wl-clipboard" 15 | else 16 | _check_dependencies "command=xclip" 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 21 | 22 | # shellcheck disable=SC2086 23 | input_files=$(basename --multiple -- $input_files) 24 | 25 | # Run the main process. 26 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 27 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 28 | wl-copy "$input_files"$'\n' 2>/dev/null 29 | else 30 | xclip -selection clipboard -i <<<"$input_files" 2>/dev/null 31 | fi 32 | 33 | _display_result_box "" 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Clipboard operations/Copy filename to clipboard (recursive): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local output_dir="" 10 | 11 | # Execute initial checks. 12 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 13 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 14 | _check_dependencies "command=wl-copy; package=wl-clipboard" 15 | else 16 | _check_dependencies "command=xclip" 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=all; par_recursive=true; par_get_pwd=true") 21 | 22 | # shellcheck disable=SC2086 23 | input_files=$(basename --multiple -- $input_files) 24 | 25 | # Run the main process. 26 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 27 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 28 | wl-copy "$input_files"$'\n' 2>/dev/null 29 | else 30 | xclip -selection clipboard -i <<<"$input_files" 2>/dev/null 31 | fi 32 | 33 | _display_result_box "" 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Clipboard operations/Copy filepath to clipboard: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local output_dir="" 10 | 11 | # Execute initial checks. 12 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 13 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 14 | _check_dependencies "command=wl-copy; package=wl-clipboard" 15 | else 16 | _check_dependencies "command=xclip" 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 21 | 22 | input_files=$(_convert_delimited_string_to_text "$input_files") 23 | 24 | # Run the main process. 25 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 26 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 27 | wl-copy "$input_files"$'\n' 2>/dev/null 28 | else 29 | xclip -selection clipboard -i <<<"$input_files" 2>/dev/null 30 | fi 31 | 32 | _display_result_box "" 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Clipboard operations/Copy filepath to clipboard (recursive): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local output_dir="" 10 | 11 | # Execute initial checks. 12 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 13 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 14 | _check_dependencies "command=wl-copy; package=wl-clipboard" 15 | else 16 | _check_dependencies "command=xclip" 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=all; par_recursive=true; par_get_pwd=true") 21 | 22 | input_files=$(_convert_delimited_string_to_text "$input_files") 23 | 24 | # Run the main process. 25 | if [[ -n "${XDG_SESSION_TYPE+x}" ]] && 26 | [[ "${XDG_SESSION_TYPE,,}" == "wayland" ]]; then 27 | wl-copy "$input_files"$'\n' 2>/dev/null 28 | else 29 | xclip -selection clipboard -i <<<"$input_files" 2>/dev/null 30 | fi 31 | 32 | _display_result_box "" 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Directories and files/Compare items (via diff): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local std_output="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_min_items=2; par_max_items=2; par_sort_list=true") 16 | 17 | # Extract the two file or directory paths from the input. 18 | local file_1="" 19 | local file_2="" 20 | file_1=$(cut -d "$FIELD_SEPARATOR" -f 1 <<<"$input_files") 21 | file_2=$(cut -d "$FIELD_SEPARATOR" -f 2 <<<"$input_files") 22 | 23 | # Append a trailing slash if the path is a directory to ensure proper comparison. 24 | [[ -d "$file_1" ]] && file_1+="/" 25 | [[ -d "$file_2" ]] && file_2+="/" 26 | 27 | # Run the main process. 28 | std_output=$(diff --no-dereference --brief --recursive -- "$file_1" "$file_2" 2>&1) 29 | 30 | # FORMAT THE OUTPUT: 31 | # Remove any occurrence of the current working directory. 32 | std_output=$(_text_remove_pwd "$std_output") 33 | # Sort the text. 34 | std_output=$(_text_sort "$std_output") 35 | # If no differences are found, set a default message. 36 | if [[ -z "$std_output" ]]; then 37 | std_output="(No differences)" 38 | fi 39 | 40 | _display_text_box "$std_output" 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Directories and files/List empty directories: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=E 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local std_output="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=directory; par_get_pwd=true") 17 | 18 | # Run the main process. 19 | # shellcheck disable=SC2086 20 | std_output=$(find $input_files -type d -empty ! -path "$IGNORE_FIND_PATH" -printf "%p\n" 2>/dev/null) 21 | std_output=$(_text_remove_pwd "$std_output") 22 | 23 | _display_list_box "$std_output" "--column=Directory" "empty directories" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Directories and files/List file mime: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=1 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(_text_sort "$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Mime;--column=File" "files" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | local file_mime="" 33 | 34 | file_mime=$(file --brief --mime-type -- "$input_file" 2>/dev/null) 35 | 36 | if [[ -z "$file_mime" ]]; then 37 | return 38 | fi 39 | 40 | if [[ "$file_mime" == "cannot"* ]]; then 41 | return 42 | fi 43 | 44 | # Run the main process. 45 | std_output="$file_mime$FIELD_SEPARATOR$input_file" 46 | std_output=$(_text_remove_pwd "$std_output") 47 | 48 | _storage_text_write_ln "$std_output" 49 | } 50 | 51 | _main "$@" 52 | -------------------------------------------------------------------------------- /Directories and files/List hidden items: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=H 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local std_output="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 17 | 18 | # Run the main process. 19 | # shellcheck disable=SC2086 20 | std_output=$(find $input_files ! -path "$IGNORE_FIND_PATH" -regextype posix-extended -regex ".*/\.[^/]*" -printf "%p\n" 2>/dev/null) 21 | std_output=$(_text_remove_pwd "$std_output") 22 | 23 | _display_list_box "$std_output" "--column=Item" "hidden items" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Directories and files/List item properties: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_recursive=true; par_get_pwd=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | std_output=$(_text_sort "$std_output") 23 | 24 | _display_list_box "$std_output" "--column=Size;--column=Modified;--column=Created;--column=Type;--column=File" "items" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local std_output="" 31 | 32 | # Run the main process. 33 | std_output=$(stat --format="%s$FIELD_SEPARATOR%y$FIELD_SEPARATOR%w$FIELD_SEPARATOR%F" -- "$input_file" 2>/dev/null) 34 | # shellcheck disable=SC2001 35 | std_output=$(sed "s|\([0-9]\{4\}-[0-1][0-9]-[0-3][0-9]\)[^$FIELD_SEPARATOR]*|\1|g" <<<"$std_output") 36 | 37 | _storage_text_write_ln "$std_output$FIELD_SEPARATOR$(_text_remove_pwd "$input_file")" 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Directories and files/List largest directories: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=9 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=directory; par_get_pwd=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(sort -h --reverse <<<"$std_output") # Sort the result. 24 | std_output=$(head -n 15 <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=Size;--column=File" "largest directories" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(du -h -- "$input_file" 2>/dev/null) 36 | std_output=$(_text_remove_pwd "$std_output") 37 | std_output=$(grep -v "\.$" <<<"$std_output") 38 | # shellcheck disable=SC2001 39 | std_output=$(sed "s|\([^ ]*\)\t\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output") 40 | 41 | _storage_text_write_ln "$std_output" 42 | } 43 | 44 | _main "$@" 45 | -------------------------------------------------------------------------------- /Directories and files/List largest files: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=0 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(sort -h --reverse <<<"$std_output") # Sort the result. 24 | std_output=$(head -n 15 <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=Size;--column=File" "largest files" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(du -h -- "$input_file" 2>/dev/null) 36 | std_output=$(_text_remove_pwd "$std_output") 37 | # shellcheck disable=SC2001 38 | std_output=$(sed "s|\([^ ]*\)\t\(.*\)|\1$FIELD_SEPARATOR\2|g" <<<"$std_output") 39 | 40 | _storage_text_write_ln "$std_output" 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Directories and files/List permissions and owners: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=P 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=all; par_recursive=true; par_get_pwd=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(_text_sort "$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Octal;--column=User;--column=Group;--column=Type;--column=File" "items" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | 33 | # Run the main process. 34 | std_output=$(stat --format="%a$FIELD_SEPARATOR%U$FIELD_SEPARATOR%G$FIELD_SEPARATOR%F$FIELD_SEPARATOR%n" -- "$input_file" 2>/dev/null) 35 | std_output=$(_text_remove_pwd "$std_output") 36 | 37 | _storage_text_write_ln "$std_output" 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Directories and files/List recently modified files: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local std_output="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 16 | 17 | # Run the main process. 18 | # shellcheck disable=SC2086 19 | std_output=$(find $input_files -type f \ 20 | ! -path "$IGNORE_FIND_PATH" ! -path '*/.*' \ 21 | -printf "%TY-%Tm-%Td$FIELD_SEPARATOR%TT$FIELD_SEPARATOR%p\n" 2>/dev/null) 22 | std_output=$(_text_remove_pwd "$std_output") 23 | std_output=$(sort -k1,1r -k2,2r <<<"$std_output") # Sort the result. 24 | std_output=$(head -n 50 <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=Date;--column=Time;--column=File" "files" "false" 27 | } 28 | 29 | _main "$@" 30 | -------------------------------------------------------------------------------- /Directories and files/Open item location: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=O 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=xdg-open; package=xdg-utils" 14 | input_files=$(_get_files "par_type=all; par_max_items=20; par_get_pwd=true") 15 | 16 | # Run the main process. 17 | _open_items_locations "$input_files" "true" 18 | } 19 | 20 | _main "$@" 21 | -------------------------------------------------------------------------------- /Directories and files/Reset permissions (recursive): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | 15 | if ! _display_question_box "This action will set permissions recursively.\n\nDo you want to continue?"; then 16 | _exit_script 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=all") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local std_output="" 31 | local new_pemission="" 32 | 33 | # Run the main process. 34 | new_pemission=$(printf "%04o" "$((0666 - $(umask)))") 35 | std_output=$(find "$input_file" -type f ! -path "$IGNORE_FIND_PATH" -exec chmod "$new_pemission" -- {} \+ 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | 38 | new_pemission=$(printf "%04o" "$((0777 - $(umask)))") 39 | std_output=$(find "$input_file" -type d ! -path "$IGNORE_FIND_PATH" -exec chmod "$new_pemission" -- {} \+ 2>&1) 40 | _check_output "$?" "$std_output" "$input_file" "" || return 1 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Document/Convert documents/Convert to 'epub': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=pandoc" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_validate_conflict=true; par_select_extension='csv|docx|fb2|gfm|htm|html|json|latex|markdown|md|odt|opml|org|rst'") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=epub") 31 | std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/Convert documents/Convert to 'fb2': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=pandoc" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_validate_conflict=true; par_select_extension='csv|docx|epub|gfm|htm|html|json|latex|markdown|md|odt|opml|org|rst'") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=fb2") 31 | std_output=$(pandoc --standalone -o "$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/Convert documents/Convert to 'markdown': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=pandoc" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_validate_conflict=true; par_select_extension='csv|docx|epub|fb2|gfm|htm|html|json|latex|odt|opml|org|rst'") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=md") 31 | std_output=$(pandoc -t gfm --wrap=none -s -o "$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/PDF combine, split/Combine multiple PDFs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfunite; pkg_manager=apt; package=poppler-utils | 15 | command=pdfunite; pkg_manager=dnf; package=poppler-utils | 16 | command=pdfunite; pkg_manager=pacman; package=poppler | 17 | command=pdfunite; pkg_manager=zypper; package=poppler-tools" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf; par_min_items=2; par_sort_list=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | _main_task "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_files=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "Combined documents.pdf" "$output_dir" "par_extension_opt=preserve") 34 | # shellcheck disable=SC2086 35 | std_output=$(pdfunite -- $input_files "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF combine, split/Split into single-page PDFs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfseparate; pkg_manager=apt; package=poppler-utils | 15 | command=pdfseparate; pkg_manager=dnf; package=poppler-utils | 16 | command=pdfseparate; pkg_manager=pacman; package=poppler | 17 | command=pdfseparate; pkg_manager=zypper; package=poppler-tools" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=%04d.pdf") 35 | std_output=$(pdfseparate "$input_file" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF encrypt, decrypt/Decrypt (remove password): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | TEMP_DATA_TASK=$(_display_password_box_define) || _exit_script 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "$output_dir" 22 | _display_result_box "$output_dir" 23 | } 24 | 25 | _main_task() { 26 | local input_file=$1 27 | local output_dir=$2 28 | local output_file="" 29 | local std_output="" 30 | 31 | # Run the main process. 32 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 33 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 34 | std_output=$(qpdf --decrypt --password="$TEMP_DATA_TASK" "$input_file" "$output_file" 2>&1) 35 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 36 | } 37 | 38 | _main "$@" 39 | -------------------------------------------------------------------------------- /Document/PDF encrypt, decrypt/Decrypt (remove restrictions): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 32 | std_output=$(qpdf --decrypt "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF encrypt, decrypt/Encrypt (set a password): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | TEMP_DATA_TASK=$(_display_password_box_define) || _exit_script 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "$output_dir" 22 | _display_result_box "$output_dir" 23 | } 24 | 25 | _main_task() { 26 | local input_file=$1 27 | local output_dir=$2 28 | local output_file="" 29 | local std_output="" 30 | 31 | # Run the main process. 32 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 33 | std_output=$(qpdf --encrypt "$TEMP_DATA_TASK" "$TEMP_DATA_TASK" 256 -- "$input_file" "$output_file" 2>&1) 34 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 35 | } 36 | 37 | _main "$@" 38 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/2 pages per sheet (1x2, landscape): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "1x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/2 pages per sheet (1x2, portrait): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "1x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/2 pages per sheet (2x1, landscape): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x1" --landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/2 pages per sheet (2x1, portrait): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x1" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/4 pages per sheet (2x2, landscape): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/4 pages per sheet (2x2, portrait): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/8 pages per sheet (2x4, landscape): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x4" --landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/8 pages per sheet (2x4, portrait): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "2x4" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/8 pages per sheet (4x2, landscape): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "4x2" --landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF multiple-page layout/8 pages per sheet (4x2, portrait): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --nup "4x2" --no-landscape --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF optimize, shrink/List non-linearized PDFs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies " 13 | command=pdfinfo; pkg_manager=apt; package=poppler-utils | 14 | command=pdfinfo; pkg_manager=dnf; package=poppler-utils | 15 | command=pdfinfo; pkg_manager=pacman; package=poppler | 16 | command=pdfinfo; pkg_manager=zypper; package=poppler-tools" 17 | _display_wait_box "2" 18 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_extension=pdf") 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "" 22 | 23 | local std_output="" 24 | std_output=$(_storage_text_read_all) 25 | std_output=$(_text_sort "$std_output") 26 | 27 | _display_list_box "$std_output" "--column=File" "non-linearized PDFs" 28 | } 29 | 30 | _main_task() { 31 | local input_file=$1 32 | local output_dir=$2 33 | local temp_file="" 34 | 35 | # Save the result only for 'not linearized (not optimized)' PDFs. 36 | if pdfinfo -- "$input_file" | grep --ignore-case "Optimized:" | grep --quiet --ignore-case "no"; then 37 | _storage_text_write_ln "$(_text_remove_pwd "$input_file")" 38 | fi 39 | } 40 | 41 | _main "$@" 42 | -------------------------------------------------------------------------------- /Document/PDF optimize, shrink/Optimize for web (linearize): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 32 | std_output=$(qpdf --stream-data=compress --linearize "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF optimize, shrink/Reduce resolution (150 dpi, e-book): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gs; package=ghostscript" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | std_output=$(gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/ebook -sOutputFile="$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/PDF optimize, shrink/Reduce resolution (300 dpi, printer): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gs; package=ghostscript" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | std_output=$(gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dPDFSETTINGS=/printer -sOutputFile="$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/PDF paper size/Paper size to A3: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --papersize "{297mm,420mm}" --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF paper size/Paper size to A4: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --papersize "{210mm,297mm}" --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF paper size/Paper size to A5: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --papersize "{148mm,210mm}" --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF paper size/Paper size to US Legal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --papersize "{8.5in,14in}" --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF paper size/Paper size to US Letter: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfjam; pkg_manager=apt; package=texlive-extra-utils | 15 | command=pdfjam; pkg_manager=dnf; package=texlive-pdfjam | 16 | command=pdfjam; pkg_manager=pacman; package=texlive-binextra | 17 | command=pdfjam; pkg_manager=zypper; package=texlive-pdfjam-bin" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(pdfjam --papersize "{8.5in,11in}" --outfile "$output_file" -- "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF rotate/PDF Rotate (180 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 32 | std_output=$(qpdf --rotate=180:1-z "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF rotate/PDF Rotate (270 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 32 | std_output=$(qpdf --rotate=270:1-z "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF rotate/PDF Rotate (90 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 32 | std_output=$(qpdf --rotate=90:1-z "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF text recognition (OCR)/List non-searchable PDFs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies " 13 | command=pdffonts; pkg_manager=apt; package=poppler-utils | 14 | command=pdffonts; pkg_manager=dnf; package=poppler-utils | 15 | command=pdffonts; pkg_manager=pacman; package=poppler | 16 | command=pdffonts; pkg_manager=zypper; package=poppler-tools" 17 | _display_wait_box "2" 18 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_extension=pdf") 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "" 22 | 23 | local std_output="" 24 | std_output=$(_storage_text_read_all) 25 | std_output=$(_text_sort "$std_output") 26 | 27 | _display_list_box "$std_output" "--column=File" "non-searchable PDFs" 28 | } 29 | 30 | _main_task() { 31 | local input_file=$1 32 | local output_dir=$2 33 | local temp_file="" 34 | 35 | # Save the result only for 'without fonts' PDFs. 36 | if ! pdffonts -- "$input_file" | sed -n 3p | grep --quiet "."; then 37 | _storage_text_write_ln "$(_text_remove_pwd "$input_file")" 38 | fi 39 | } 40 | 41 | _main "$@" 42 | -------------------------------------------------------------------------------- /Document/PDF tools/Add PDF watermark (overlay): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | sleep 0.2 # Avoid 'wait_box' open before. 19 | TEMP_DATA_TASK=$(_display_file_selection_box \ 20 | "PDF files | *.pdf" \ 21 | "Choose an PDF to use as the watermark") 22 | 23 | # Execute the function '_main_task' for each file in parallel. 24 | _run_task_parallel "$input_files" "$output_dir" 25 | _display_result_box "$output_dir" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local output_file="" 32 | local std_output="" 33 | 34 | # Run the main process. 35 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 36 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 37 | std_output=$(qpdf --overlay "$TEMP_DATA_TASK" --repeat=1 -- "$input_file" "$output_file" 2>&1) 38 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 39 | } 40 | 41 | _main "$@" 42 | -------------------------------------------------------------------------------- /Document/PDF tools/Add PDF watermark (underlay): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=qpdf" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | sleep 0.2 # Avoid 'wait_box' open before. 19 | TEMP_DATA_TASK=$(_display_file_selection_box \ 20 | "PDF files | *.pdf" \ 21 | "Choose an PDF to use as the watermark") 22 | 23 | # Execute the function '_main_task' for each file in parallel. 24 | _run_task_parallel "$input_files" "$output_dir" 25 | _display_result_box "$output_dir" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local output_file="" 32 | local std_output="" 33 | 34 | # Run the main process. 35 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 36 | # NOTE: Older 'qpdf' versions do not support ' -- ' in the command line. 37 | std_output=$(qpdf --underlay "$TEMP_DATA_TASK" --repeat=1 -- "$input_file" "$output_file" 2>&1) 38 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 39 | } 40 | 41 | _main "$@" 42 | -------------------------------------------------------------------------------- /Document/PDF tools/Convert to 'PDFA-2b': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gs; package=ghostscript" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | std_output=$(gs -q -dNOPAUSE -dBATCH -dPDFA=2 -dPDFACompatibilityPolicy=1 -sColorConversionStrategy=UseDeviceIndependentColor -sDEVICE=pdfwrite -sOutputFile="$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/PDF tools/Extract images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=pdfimages; pkg_manager=apt; package=poppler-utils | 15 | command=pdfimages; pkg_manager=dnf; package=poppler-utils | 16 | command=pdfimages; pkg_manager=pacman; package=poppler | 17 | command=pdfimages; pkg_manager=zypper; package=poppler-tools" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=strip") 35 | std_output=$(pdfimages -all "$input_file" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Document/PDF tools/List annotated PDFs: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies "" 13 | _display_wait_box "2" 14 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_select_extension=pdf") 15 | 16 | # Execute the function '_main_task' for each file in parallel. 17 | _run_task_parallel "$input_files" "" 18 | 19 | local std_output="" 20 | std_output=$(_storage_text_read_all) 21 | std_output=$(_text_sort "$std_output") 22 | 23 | _display_list_box "$std_output" "--column=File" "PDFs" 24 | } 25 | 26 | _main_task() { 27 | local input_file=$1 28 | local output_dir=$2 29 | 30 | # Run the main process. 31 | if grep -z -a -m1 --quiet "/Subtype\s*\(/Caret\|/Circle\|/FileAttachment\|/FreeText\|/Highlight\|/Ink\|/Line\|/Movie\|/Polygon\|/PolyLine\|/Popup\|/Printermark\|/Screen\|/Sound\|/Square\|/Squiggly\|/Stamp\|/StrikeOut\|/Text\|/Underline\|/Watermark\)" "$input_file"; then 32 | _storage_text_write_ln "$(_text_remove_pwd "$input_file")" 33 | fi 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Document/PDF tools/Remove PDF annotations: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gs; package=ghostscript" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_extension=pdf") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | std_output=$(gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dShowAnnots=false -sOutputFile="$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Document/Print documents/Print (paper size A4): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=lp; package=cups-client" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local std_output="" 26 | 27 | # Run the main process. 28 | std_output=$(lp -o media=A4 "$input_file" 2>&1) 29 | _check_output "$?" "$std_output" "$input_file" "" || return 1 30 | } 31 | 32 | _main "$@" 33 | -------------------------------------------------------------------------------- /Document/Print documents/Print (paper size US Legal): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=lp; package=cups-client" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local std_output="" 26 | 27 | # Run the main process. 28 | std_output=$(lp -o media=Legal "$input_file" 2>&1) 29 | _check_output "$?" "$std_output" "$input_file" "" || return 1 30 | } 31 | 32 | _main "$@" 33 | -------------------------------------------------------------------------------- /Document/Print documents/Print (paper size US Letter): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=lp; package=cups-client" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local std_output="" 26 | 27 | # Run the main process. 28 | std_output=$(lp -o media=Letter "$input_file" 2>&1) 29 | _check_output "$?" "$std_output" "$input_file" "" || return 1 30 | } 31 | 32 | _main "$@" 33 | -------------------------------------------------------------------------------- /File encryption/GPG Decrypt: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=gpg; pkg_manager=apt; package=gpg | 15 | command=gpg; pkg_manager=dnf; package=gnupg2 | 16 | command=gpg; pkg_manager=pacman; package=gnupg | 17 | command=gpg; pkg_manager=zypper; package=gpg2" 18 | input_files=$(_get_files "par_type=file; par_select_mime='application/octet-stream|application/pgp|application/pgp-encrypted|text/plain'") 19 | output_dir=$(_get_output_dir "par_use_same_dir=true") 20 | 21 | # Execute the function '_main_task' for each file in parallel. 22 | _run_task_parallel "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_file=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=strip") 34 | std_output=$(gpg --batch --yes --decrypt --output "$output_file" -- "$input_file" 2>&1) 35 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 36 | } 37 | 38 | _main "$@" 39 | -------------------------------------------------------------------------------- /File encryption/GPG Verify signature: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies " 13 | command=gpg; pkg_manager=apt; package=gpg | 14 | command=gpg; pkg_manager=dnf; package=gnupg2 | 15 | command=gpg; pkg_manager=pacman; package=gnupg | 16 | command=gpg; pkg_manager=zypper; package=gpg2" 17 | _display_wait_box "2" 18 | input_files=$(_get_files "par_type=file; par_select_mime='application/octet-stream|application/pgp|application/pgp-encrypted|application/pgp-signature|text/PGP|text/plain'") 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "" 22 | 23 | local output_dir="" 24 | std_output=$(_storage_text_read_all) 25 | 26 | _display_text_box "$std_output" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(gpg --yes --verify -- "$input_file" 2>&1) 36 | 37 | _storage_text_write_ln "File: \"$(_text_remove_pwd "$input_file")\""$'\n'"$std_output"$'\n' 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Hash and checksum/List MD5: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_recursive=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | std_output=$(_text_sort "$std_output") 23 | # shellcheck disable=SC2001 24 | std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=MD5;--column=File" "files" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(md5sum -- "$input_file" 2>/dev/null) 36 | if [[ -z "$std_output" ]]; then 37 | return 38 | fi 39 | 40 | std_output=$(_text_remove_pwd "$std_output") 41 | 42 | # shellcheck disable=SC2001 43 | std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 44 | 45 | _storage_text_write_ln "$std_output" 46 | } 47 | 48 | _main "$@" 49 | -------------------------------------------------------------------------------- /Hash and checksum/List SHA-1: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_recursive=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | std_output=$(_text_sort "$std_output") 23 | # shellcheck disable=SC2001 24 | std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=SHA-1;--column=File" "files" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(sha1sum -- "$input_file" 2>/dev/null) 36 | if [[ -z "$std_output" ]]; then 37 | return 38 | fi 39 | 40 | std_output=$(_text_remove_pwd "$std_output") 41 | 42 | # shellcheck disable=SC2001 43 | std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 44 | 45 | _storage_text_write_ln "$std_output" 46 | } 47 | 48 | _main "$@" 49 | -------------------------------------------------------------------------------- /Hash and checksum/List SHA-256: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_recursive=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | std_output=$(_text_sort "$std_output") 23 | # shellcheck disable=SC2001 24 | std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=SHA-256;--column=File" "files" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(sha256sum -- "$input_file" 2>/dev/null) 36 | if [[ -z "$std_output" ]]; then 37 | return 38 | fi 39 | 40 | std_output=$(_text_remove_pwd "$std_output") 41 | 42 | # shellcheck disable=SC2001 43 | std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 44 | 45 | _storage_text_write_ln "$std_output" 46 | } 47 | 48 | _main "$@" 49 | -------------------------------------------------------------------------------- /Hash and checksum/List SHA-512: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_recursive=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | std_output=$(_text_sort "$std_output") 23 | # shellcheck disable=SC2001 24 | std_output=$(sed "s|\(.*\)$FIELD_SEPARATOR\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 25 | 26 | _display_list_box "$std_output" "--column=SHA-512;--column=File" "files" 27 | } 28 | 29 | _main_task() { 30 | local input_file=$1 31 | local output_dir=$2 32 | local std_output="" 33 | 34 | # Run the main process. 35 | std_output=$(sha512sum -- "$input_file" 2>/dev/null) 36 | if [[ -z "$std_output" ]]; then 37 | return 38 | fi 39 | 40 | std_output=$(_text_remove_pwd "$std_output") 41 | 42 | # shellcheck disable=SC2001 43 | std_output=$(sed "s|\([^ ]*\)\s*\(.*\)|\2$FIELD_SEPARATOR\1|g" <<<"$std_output") 44 | 45 | _storage_text_write_ln "$std_output" 46 | } 47 | 48 | _main "$@" 49 | -------------------------------------------------------------------------------- /Hash and checksum/List all file hashes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=rhash" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_recursive=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | local std_output="" 21 | std_output=$(_storage_text_read_all) 22 | 23 | _display_text_box "$std_output" 24 | } 25 | 26 | _main_task() { 27 | local input_file=$1 28 | local output_dir=$2 29 | local std_output="" 30 | 31 | # Run the main process. 32 | std_output=$(rhash --printf="File: \"%p\"\nCRC32: %c\nMD5: %m\nSHA-1: %h\nSHA-224: %{sha-224}\nSHA-256: %{sha-256}\nSHA-384: %{sha-384}\nSHA-512: %{sha-512}\n " -- "$input_file" 2>/dev/null) 33 | if [[ -z "$std_output" ]]; then 34 | return 35 | fi 36 | 37 | # FORMAT THE OUTPUT: 38 | # Remove any occurrence of the current working directory. 39 | std_output=$(_text_remove_pwd "$std_output") 40 | 41 | _storage_text_write_ln "$std_output" 42 | } 43 | 44 | _main "$@" 45 | -------------------------------------------------------------------------------- /Image/Color operations/Colorspace to Gray: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -colorspace gray -type palette "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Color operations/Desaturate (average): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -grayscale average "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Color operations/Desaturate (luma): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -grayscale rec709luma "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Combine images into a 'gif': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | _main_task "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_files=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "Animated image.gif" "$output_dir" "par_extension_opt=preserve") 34 | # shellcheck disable=SC2086 35 | std_output=$(convert -delay 100 -loop 0 $input_files "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Combine images into a 'pdf': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | _main_task "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_files=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "Combined images.pdf" "$output_dir" "par_extension_opt=preserve") 34 | # shellcheck disable=SC2086 35 | std_output=$(convert $input_files "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Split into 2 parts (horizontally): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -crop 100%x50% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Split into 2 parts (vertically): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -crop 50%x100% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Split into 4 parts: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -crop 50%x50% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Stack images (horizontally): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | _main_task "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_files=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "Stacked images (horizontal).png" "$output_dir" "par_extension_opt=preserve") 34 | # shellcheck disable=SC2086 35 | std_output=$(convert $input_files +append +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Combine, split/Stack images (vertically): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_min_items=2; par_sort_list=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | _main_task "$input_files" "$output_dir" 23 | _display_result_box "$output_dir" 24 | } 25 | 26 | _main_task() { 27 | local input_files=$1 28 | local output_dir=$2 29 | local output_file="" 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_file=$(_get_output_filename "Stacked images (vertical).png" "$output_dir" "par_extension_opt=preserve") 34 | # shellcheck disable=SC2086 35 | std_output=$(convert $input_files -append +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'avif': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=avif") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'bmp': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=bmp") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'gif': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=gif") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'jpg': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=jpg") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'png': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'tif': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=tif") 35 | std_output=$(convert "$input_file" "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Convert/Convert to 'webp': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=webp") 35 | std_output=$(convert "$input_file" -auto-orient "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Automatic crop: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -trim +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Automatic crop (15 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -fuzz 15% -trim +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Resize (25 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -resize 25%x25% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Resize (50 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -resize 50%x50% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Resize (75 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -resize 75%x75% +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Crop, resize/Resize and crop (1920x1080): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -resize "1920x1080^" -gravity center -crop 1920x1080+0+0 -strip +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Flip, rotate/Flip (horizontally): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -transparent none -flop "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Flip, rotate/Flip (vertically): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -transparent none -flip "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Flip, rotate/Rotate (180 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -transparent none -rotate 180 +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Flip, rotate/Rotate (270 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -transparent none -rotate 270 +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Flip, rotate/Rotate (90 deg): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -transparent none -rotate 90 +repage "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Image similarity/Find similar images (65 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils" 13 | _display_wait_box "0" 14 | input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/") 15 | 16 | # Get the installed image viewer. 17 | local image_viewer="" 18 | image_viewer=$(_xdg_get_default_app "image/jpeg") 19 | 20 | # Run the main process. 21 | # shellcheck disable=SC2086 22 | findimagedupes --recurse --threshold=65% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null 23 | _display_result_box "" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Image/Image similarity/Find similar images (75 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils" 13 | _display_wait_box "0" 14 | input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/") 15 | 16 | # Get the installed image viewer. 17 | local image_viewer="" 18 | image_viewer=$(_xdg_get_default_app "image/jpeg") 19 | 20 | # Run the main process. 21 | # shellcheck disable=SC2086 22 | findimagedupes --recurse --threshold=75% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null 23 | _display_result_box "" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Image/Image similarity/Find similar images (85 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils" 13 | _display_wait_box "0" 14 | input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/") 15 | 16 | # Get the installed image viewer. 17 | local image_viewer="" 18 | image_viewer=$(_xdg_get_default_app "image/jpeg") 19 | 20 | # Run the main process. 21 | # shellcheck disable=SC2086 22 | findimagedupes --recurse --threshold=85% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null 23 | _display_result_box "" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Image/Image similarity/Find similar images (95 pct): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | 11 | # Execute initial checks. 12 | _check_dependencies "command=findimagedupes | command=xdg-open; package=xdg-utils" 13 | _display_wait_box "0" 14 | input_files=$(_get_files "par_type=file; par_recursive=true; par_select_mime=image/") 15 | 16 | # Get the installed image viewer. 17 | local image_viewer="" 18 | image_viewer=$(_xdg_get_default_app "image/jpeg") 19 | 20 | # Run the main process. 21 | # shellcheck disable=SC2086 22 | findimagedupes --recurse --threshold=95% --program="$(which "$image_viewer")" -- $input_files 2>/dev/null 23 | _display_result_box "" 24 | } 25 | 26 | _main "$@" 27 | -------------------------------------------------------------------------------- /Image/Optimize/Optimize 'png' images: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=optipng" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 16 | output_dir=$(_get_output_dir "par_use_same_dir=false") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 31 | std_output=$(optipng -out "$output_file" -- "$input_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Image/Optimize/Remove metadata (via ExifTool): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=exiftool; pkg_manager=apt; package=libimage-exiftool-perl | 15 | command=exiftool; pkg_manager=dnf; package=perl-Image-ExifTool | 16 | command=exiftool; pkg_manager=pacman; package=perl-image-exiftool | 17 | command=exiftool; pkg_manager=zypper; package=exiftool" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(exiftool -preserve -ignoreMinorErrors -all= -out "$output_file" "$input_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/SVG files/Convert 'svg' to 'svgz' (compress): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gzip" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_mime='image/svg+xml'") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=svgz") 31 | std_output=$(gzip "$input_file" --no-name -c >"$output_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Image/SVG files/Convert 'svgz' to 'svg' (decompress): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=gzip" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_select_mime='application/gzip'") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=svg") 31 | std_output=$(gzip -S gz -d "$input_file" -c >"$output_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Image/Transparency/Replace alpha with black: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -background black -layers flatten "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Transparency/Replace alpha with magenta: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -background magenta -layers flatten "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Transparency/Replace alpha with white: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(convert "$input_file" -background white -layers flatten "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Transparency/Replace black with alpha: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png") 35 | std_output=$(convert "$input_file" -transparent black "$output_file" 2>&1) 36 | _check_result "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Transparency/Replace magenta with alpha: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png") 35 | std_output=$(convert "$input_file" -transparent magenta "$output_file" 2>&1) 36 | _check_result "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Image/Transparency/Replace white with alpha: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=convert; pkg_manager=apt; package=imagemagick | 15 | command=convert; pkg_manager=dnf; package=ImageMagick | 16 | command=convert; pkg_manager=pacman; package=imagemagick | 17 | command=convert; pkg_manager=zypper; package=ImageMagick" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=image/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png") 35 | std_output=$(convert "$input_file" -transparent white "$output_file" 2>&1) 36 | _check_result "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020-2024 Cristiano Fraga G. Nunes. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /Link operations/Create hard link here: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve; par_prefix='Hard link to'") 31 | std_output=$(ln -- "$input_file" "$output_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Link operations/Create hard link to...: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=file") 16 | sleep 0.2 # Avoid 'wait_box' open before. 17 | output_dir=$(_display_dir_selection_box) 18 | 19 | # Execute the function '_main_task' for each file in parallel. 20 | _run_task_parallel "$input_files" "$output_dir" 21 | _display_result_box "$output_dir" 22 | } 23 | 24 | _main_task() { 25 | local input_file=$1 26 | local output_dir=$2 27 | local output_file="" 28 | local std_output="" 29 | 30 | # Run the main process. 31 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 32 | std_output=$(ln -- "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Link operations/Create symbolic link here: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local output_file="" 27 | local std_output="" 28 | 29 | # Run the main process. 30 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve; par_prefix='Link to'") 31 | std_output=$(ln -s -- "$input_file" "$output_file" 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Link operations/Create symbolic link to...: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "0" 15 | input_files=$(_get_files "par_type=all") 16 | sleep 0.2 # Avoid 'wait_box' open before. 17 | output_dir=$(_display_dir_selection_box) 18 | 19 | # Execute the function '_main_task' for each file in parallel. 20 | _run_task_parallel "$input_files" "$output_dir" 21 | _display_result_box "$output_dir" 22 | } 23 | 24 | _main_task() { 25 | local input_file=$1 26 | local output_dir=$2 27 | local output_file="" 28 | local std_output="" 29 | 30 | # Run the main process. 31 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 32 | std_output=$(ln -s -- "$input_file" "$output_file" 2>&1) 33 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 34 | } 35 | 36 | _main "$@" 37 | -------------------------------------------------------------------------------- /Link operations/List broken links: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local std_output="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 16 | 17 | # Run the main process. 18 | # shellcheck disable=SC2086 19 | std_output=$(find $input_files -xtype l ! -path "$IGNORE_FIND_PATH" 2>/dev/null) 20 | std_output=$(_text_remove_pwd "$std_output") 21 | 22 | _display_list_box "$std_output" "--column=Link" "broken links" "false" 23 | } 24 | 25 | _main "$@" 26 | -------------------------------------------------------------------------------- /Link operations/List hard links: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local std_output="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 16 | 17 | # Run the main process. 18 | # shellcheck disable=SC2086 19 | std_output=$(find $input_files -type f ! -path "$IGNORE_FIND_PATH" -links +1 -printf "%i %p\n" 2>/dev/null) 20 | std_output=$(_text_remove_pwd "$std_output") 21 | std_output=$(_text_sort "$std_output") 22 | std_output=$(awk 'NR==1 {prev=$1} $1!=prev {print "\nHard links (for the same file):"; prev=$1} {print $0}' <<<"$std_output") 23 | 24 | if [[ -n "$std_output" ]]; then 25 | std_output="Hard links (for the same file):"$'\n'"$std_output" 26 | fi 27 | 28 | _display_text_box "$std_output" 29 | } 30 | 31 | _main "$@" 32 | -------------------------------------------------------------------------------- /Link operations/List symbolic links: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local std_output="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all; par_get_pwd=true") 16 | 17 | # Run the main process. 18 | # shellcheck disable=SC2086 19 | std_output=$(find $input_files -type l ! -path "$IGNORE_FIND_PATH" 2>/dev/null) 20 | std_output=$(_text_remove_pwd "$std_output") 21 | 22 | _display_list_box "$std_output" "--column=Link" "symbolic links" "false" 23 | } 24 | 25 | _main "$@" 26 | -------------------------------------------------------------------------------- /Multimedia/Audio convert/Convert to 'flac': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=flac") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -ac 2 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio convert/Convert to 'wav': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=wav") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vn -ac 2 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio effects/Fade in: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "afade=d=10" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio effects/Fade out: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "areverse, afade=d=10, areverse" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio effects/Normalize: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:a "loudnorm" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio tools/Mix channels to mono: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -ac 1 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Audio tools/Produce a spectrogram: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=sox | 15 | pkg_manager=apt; package=libsox-fmt-mp3" 16 | _display_wait_box "2" 17 | input_files=$(_get_files "par_type=file; par_select_mime='audio/|video/'; par_validate_conflict=true") 18 | output_dir=$(_get_output_dir "par_use_same_dir=true") 19 | 20 | # Execute the function '_main_task' for each file in parallel. 21 | _run_task_parallel "$input_files" "$output_dir" 22 | _display_result_box "$output_dir" 23 | } 24 | 25 | _main_task() { 26 | local input_file=$1 27 | local output_dir=$2 28 | local output_file="" 29 | local std_output="" 30 | 31 | # Run the main process. 32 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=png") 33 | std_output=$(sox "$input_file" -n "spectrogram" -c "" -o "$output_file" 2>&1) 34 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 35 | } 36 | 37 | _main "$@" 38 | -------------------------------------------------------------------------------- /Multimedia/Video audio track/Remove audio: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -c:v copy -an -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video convert/Convert to 'mkv': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mkv") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video convert/Convert to 'mkv' (no re-encoding): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mkv") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vcodec copy -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video convert/Convert to 'mp4': -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mp4") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video convert/Convert to 'mp4' (no re-encoding): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/; par_validate_conflict=true") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=replace; par_extension=mp4") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -vcodec copy -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video frame rate/Frame rate to 30 FPS: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | local frame_rate="30" 33 | 34 | # Run the main process. 35 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 36 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:v "fps=fps=$frame_rate" -- "$output_file" 2>&1) 37 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Multimedia/Video frame rate/Frame rate to 60 FPS: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | local frame_rate="60" 33 | 34 | # Run the main process. 35 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 36 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -filter:v "fps=fps=$frame_rate" -- "$output_file" 2>&1) 37 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Multimedia/Video tools/Export frames (1 FPS): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "${input_file}_frame_%05d.png" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -r 1 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video tools/Export frames (10 FPS): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "${input_file}_frame_%05d.png" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -r 10 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video tools/Export frames (5 FPS): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "${input_file}_frame_%05d.png" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -r 5 -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Multimedia/Video tools/Remove metadata: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=ffmpeg; pkg_manager=apt; package=ffmpeg | 15 | command=ffmpeg; pkg_manager=dnf; package=ffmpeg-free | 16 | command=ffmpeg; pkg_manager=pacman; package=ffmpeg | 17 | command=ffmpeg; pkg_manager=zypper; package=ffmpeg" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file; par_select_mime=video/") 20 | output_dir=$(_get_output_dir "par_use_same_dir=false") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local output_file="" 31 | local std_output="" 32 | 33 | # Run the main process. 34 | output_file=$(_get_output_filename "$input_file" "$output_dir" "par_extension_opt=preserve") 35 | std_output=$(ffmpeg -hide_banner -y -i "$input_file" -map_metadata -1 -c:v copy -c:a copy -- "$output_file" 2>&1) 36 | _check_output "$?" "$std_output" "$input_file" "$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Open with/Disk Usage Analyzer: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=F7 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | 12 | # Execute initial checks. 13 | case "${XDG_CURRENT_DESKTOP,,}" in 14 | *"kde"* | *"lxqt"*) 15 | _check_dependencies "command=filelight" 16 | ;; 17 | *) 18 | _check_dependencies "command=baobab" 19 | ;; 20 | esac 21 | input_files=$(_get_files "par_type=directory; par_max_items=20; par_get_pwd=true") 22 | _unset_global_variables_file_manager 23 | 24 | _open_app "$input_files" 25 | } 26 | 27 | _open_app() { 28 | local input_files=$1 29 | 30 | local input_file="" 31 | for input_file in $input_files; do 32 | # Run the main process. 33 | if _command_exists "baobab"; then 34 | baobab -- "$input_file" & 35 | elif _command_exists "filelight"; then 36 | filelight -- "$input_file" & 37 | fi 38 | done 39 | } 40 | 41 | _main "$@" 42 | -------------------------------------------------------------------------------- /Programming/Git/Git clean: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=git" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=directory; par_get_pwd=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | _display_result_box "" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local std_output="" 27 | 28 | # Check if the current directory is a Git repository. 29 | local top_level="" 30 | top_level=$(git -C "$input_file" rev-parse --show-toplevel 2>&1) 31 | _check_output "$?" "$top_level" "$input_file" "" || return 1 32 | 33 | _directory_push "$top_level" || return 1 34 | 35 | # Run the main process. 36 | # git clean: Remove untracked files from the working tree. 37 | # -x: removes ignored files. 38 | # -d: removes untracked folders. 39 | # -f: removes untracked files. 40 | std_output=$(git clean -xdf 2>&1) 41 | _check_output "$?" "$std_output" "$input_file" "" || return 1 42 | 43 | _directory_pop || return 1 44 | } 45 | 46 | _main "$@" 47 | -------------------------------------------------------------------------------- /Programming/Git/Git init: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=git" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=directory; par_get_pwd=true") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | 20 | _display_result_box "" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local std_output="" 27 | 28 | _directory_push "$input_file" || return 1 29 | 30 | # Run the main process. 31 | std_output=$(git init 2>&1) 32 | _check_output "$?" "$std_output" "$input_file" "" || return 1 33 | 34 | _directory_pop || return 1 35 | 36 | } 37 | 38 | _main "$@" 39 | -------------------------------------------------------------------------------- /Programming/Text encodings/List encodings: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=4 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_skip_encoding='binary'; par_skip_extension='pdf|svg'") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(_text_sort "$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Encoding;--column=File" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | local file_encoding="" 33 | file_encoding=$(_get_file_encoding "$input_file") 34 | 35 | if [[ -z "$file_encoding" ]]; then 36 | return 37 | fi 38 | 39 | # Run the main process. 40 | std_output="$file_encoding$FIELD_SEPARATOR$input_file" 41 | std_output=$(_text_remove_pwd "$std_output") 42 | 43 | _storage_text_write_ln "$std_output" 44 | } 45 | 46 | _main "$@" 47 | -------------------------------------------------------------------------------- /Programming/Text statistics/List lines count: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=6 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_skip_encoding='binary'; par_skip_extension='pdf|svg'") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(sort --numeric-sort --reverse <<<"$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Count;--column=File" "files" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | 33 | # Run the main process. 34 | std_output=$(wc --lines -- "$input_file" 2>/dev/null) 35 | std_output=$(grep -v ".*[0-9]* total$" <<<"$std_output") 36 | # shellcheck disable=SC2001 37 | std_output=$(sed "s| *\([0-9]*\) *\(.*\)|\1$FIELD_SEPARATOR\2|" <<<"$std_output") 38 | std_output=$(_text_remove_pwd "$std_output") 39 | 40 | _storage_text_write_ln "$std_output" 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Programming/Text statistics/List max line length: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=7 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_skip_encoding='binary'; par_skip_extension='pdf|svg'") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(sort --numeric-sort --reverse <<<"$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Count;--column=File" "files" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | 33 | # Run the main process. 34 | std_output=$(wc --max-line-length -- "$input_file" 2>/dev/null) 35 | std_output=$(grep -v ".*[0-9]* total$" <<<"$std_output") 36 | # shellcheck disable=SC2001 37 | std_output=$(sed "s| *\([0-9]*\) *\(.*\)|\1$FIELD_SEPARATOR\2|" <<<"$std_output") 38 | std_output=$(_text_remove_pwd "$std_output") 39 | 40 | _storage_text_write_ln "$std_output" 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Programming/Text statistics/List words count: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # install_keyboard_shortcut=8 3 | 4 | # Source the script 'common-functions.sh'. 5 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 6 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 7 | source "$ROOT_DIR/common-functions.sh" 8 | 9 | _main() { 10 | local input_files="" 11 | local output_dir="" 12 | 13 | # Execute initial checks. 14 | _check_dependencies "" 15 | _display_wait_box "2" 16 | input_files=$(_get_files "par_type=file; par_recursive=true; par_get_pwd=true; par_skip_encoding='binary'; par_skip_extension='pdf|svg'") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | 21 | local std_output="" 22 | std_output=$(_storage_text_read_all) 23 | std_output=$(sort --numeric-sort --reverse <<<"$std_output") 24 | 25 | _display_list_box "$std_output" "--column=Count;--column=File" "files" 26 | } 27 | 28 | _main_task() { 29 | local input_file=$1 30 | local output_dir=$2 31 | local std_output="" 32 | 33 | # Run the main process. 34 | std_output=$(wc --words -- "$input_file" 2>/dev/null) 35 | std_output=$(grep -v ".*[0-9]* total$" <<<"$std_output") 36 | # shellcheck disable=SC2001 37 | std_output=$(sed "s| *\([0-9]*\) *\(.*\)|\1$FIELD_SEPARATOR\2|" <<<"$std_output") 38 | std_output=$(_text_remove_pwd "$std_output") 39 | 40 | _storage_text_write_ln "$std_output" 41 | } 42 | 43 | _main "$@" 44 | -------------------------------------------------------------------------------- /Programming/Text tools/Concatenate multiple files: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file; par_skip_encoding='binary'; par_skip_extension='pdf|svg'; par_min_items=2; par_sort_list=true") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | _main_task "$input_files" "$output_dir" 19 | _display_result_box "$output_dir" 20 | } 21 | 22 | _main_task() { 23 | local input_files=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local std_output="" 27 | 28 | # Run the main process. 29 | output_file=$(_get_output_filename "Concatenated files.txt" "$output_dir" "par_extension_opt=preserve") 30 | # shellcheck disable=SC2086 31 | std_output=$(cat -- $input_files >"$output_file" 2>&1) 32 | _check_output "$?" "$std_output" "" "$output_file" || return 1 33 | } 34 | 35 | _main "$@" 36 | -------------------------------------------------------------------------------- /Rename files/Remove accents (translit.): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=iconv; package=libc-bin" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Remove accents (transliterate). 33 | output_file=$(iconv -f utf8 -t ascii//TRANSLIT <<<"$filename") 34 | _check_output "$?" "$output_file" "$input_file" "" || return 1 35 | 36 | # Run the main process. 37 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Rename files/Remove brackets: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Remove brackets. 33 | # shellcheck disable=SC2001 34 | output_file=$(sed "s| *([^)]*)||g" <<<"$filename") 35 | 36 | # Run the main process. 37 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Rename files/Rename to lowercase: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Transform to lowercase. 33 | output_file=${filename,,} 34 | 35 | # Run the main process. 36 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Rename files/Rename to sentence case: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Transform to sentence case. 33 | # shellcheck disable=SC2001 34 | output_file=$(sed "s|\(\w\)\(.*\)|\U\1\L\2|g; s|\(\.\s\s*\)\(\w\)|\1\U\2|g" <<<"$filename") 35 | 36 | # Run the main process. 37 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 38 | } 39 | 40 | _main "$@" 41 | -------------------------------------------------------------------------------- /Rename files/Rename to uppercase: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Transform to uppercase. 33 | output_file=${filename^^} 34 | 35 | # Run the main process. 36 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Rename files/Replace gaps with dashes: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Replace gaps with dashes. 33 | output_file=$(tr -s -- "_ \t" "-" <<<"$filename") 34 | 35 | # Run the main process. 36 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Rename files/Replace gaps with spaces: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Replace gaps with spaces. 33 | output_file=$(tr -s -- "-_\t" " " <<<"$filename") 34 | 35 | # Run the main process. 36 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Rename files/Replace gaps with underscores: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=all") 16 | 17 | # Execute the function '_main_task' for each file in parallel. 18 | _run_task_parallel "$input_files" "$output_dir" 19 | _display_result_box "" 20 | } 21 | 22 | _main_task() { 23 | local input_file=$1 24 | local output_dir=$2 25 | local output_file="" 26 | local dir="" 27 | local filename="" 28 | 29 | dir=$(dirname -- "$input_file") 30 | filename=$(basename -- "$input_file") 31 | 32 | # Replace gaps with underscores. 33 | output_file=$(tr -s -- "- \t" "_" <<<"$filename") 34 | 35 | # Run the main process. 36 | _move_file "skip" "$input_file" "$dir/$output_file" || return 1 37 | } 38 | 39 | _main "$@" 40 | -------------------------------------------------------------------------------- /Security and recovery/File carving (via Foremost): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "command=foremost" 14 | _display_wait_box "2" 15 | input_files=$(_get_files "par_type=file") 16 | output_dir=$(_get_output_dir "par_use_same_dir=true") 17 | 18 | # Execute the function '_main_task' for each file in parallel. 19 | _run_task_parallel "$input_files" "$output_dir" 20 | _display_result_box "$output_dir" 21 | } 22 | 23 | _main_task() { 24 | local input_file=$1 25 | local output_dir=$2 26 | local std_output="" 27 | 28 | # Run the main process. 29 | output_dir="$(_strip_filename_extension "$input_file")-output" 30 | std_output=$(foremost -t all -i "$input_file" -o "$output_dir" 2>&1) 31 | _check_output "$?" "$std_output" "$input_file" "" || return 1 32 | } 33 | 34 | _main "$@" 35 | -------------------------------------------------------------------------------- /Security and recovery/File carving (via PhotoRec): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies " 14 | command=photorec; pkg_manager=apt; package=testdisk | 15 | command=photorec; pkg_manager=dnf; package=testdisk | 16 | command=photorec; pkg_manager=pacman; package=testdisk | 17 | command=photorec; pkg_manager=zypper; package=photorec" 18 | _display_wait_box "2" 19 | input_files=$(_get_files "par_type=file") 20 | output_dir=$(_get_output_dir "par_use_same_dir=true") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local std_output="" 31 | 32 | # Run the main process. 33 | output_dir="$(_strip_filename_extension "$input_file")-output" 34 | std_output=$(photorec /d "$output_dir" /cmd "$input_file" partition_none,fileopt,everything,enable,search 2>&1) 35 | _check_output "$?" "$std_output" "$input_file" "" || return 1 36 | } 37 | 38 | _main "$@" 39 | -------------------------------------------------------------------------------- /Security and recovery/Permanently delete files (shred): -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Source the script 'common-functions.sh'. 4 | SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) 5 | ROOT_DIR=$(grep --only-matching "^.*scripts[^/]*" <<<"$SCRIPT_DIR") 6 | source "$ROOT_DIR/common-functions.sh" 7 | 8 | _main() { 9 | local input_files="" 10 | local output_dir="" 11 | 12 | # Execute initial checks. 13 | _check_dependencies "" 14 | 15 | if ! _display_question_box "This action will permanently delete the selected files.\n\nDo you want to continue?"; then 16 | _exit_script 17 | fi 18 | 19 | _display_wait_box "2" 20 | input_files=$(_get_files "par_type=file") 21 | 22 | # Execute the function '_main_task' for each file in parallel. 23 | _run_task_parallel "$input_files" "$output_dir" 24 | _display_result_box "$output_dir" 25 | } 26 | 27 | _main_task() { 28 | local input_file=$1 29 | local output_dir=$2 30 | local std_output="" 31 | 32 | # Run the main process. 33 | std_output=$(shred --force --zero --remove -- "$input_file" 2>&1) 34 | _check_output "$?" "$std_output" "$input_file" "" || return 1 35 | } 36 | 37 | _main "$@" 38 | --------------------------------------------------------------------------------