This commit is contained in:
rozbrian
2026-01-10 20:46:22 +09:00
commit 304cbcc554
66 changed files with 1291 additions and 0 deletions

32
tvshow_categorize_files Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/bash
#
# to categorize named files
#
# Check if tvshow_categorize_name is available
if ! command -v tvshow_categorize_name &> /dev/null; then
echo "tvshow_categorize_name command not found"
exit 1
fi
# Find and process files
find . -maxdepth 1 -type f -print0 | while IFS= read -r -d '' file; do
# Get the name from tvshow_categorize_name
NAME="$(tvshow_categorize_name "$file")"
# Check if the name was successfully retrieved
if [[ -z "$NAME" ]]; then
echo "Failed to categorize $file"
continue
fi
echo "$file -> $NAME"
# Create the directory if it doesn't exist
if [[ ! -d "$NAME" ]]; then
sudo mkdir -p "$NAME"
fi
# Move the file to the categorized directory
sudo mv "$file" "$NAME"
done