Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #point to the folder containing all your series! careful no error checking!
- base_path="/srv/smb/Anime"
- for dir in "$base_path"/*/; do
- # Skip if not a directory
- [ -d "$dir" ] || continue
- echo "Checking: $dir"
- # Look for subfolder starting with s or S
- if find "$dir" -mindepth 1 -maxdepth 1 -type d -iname "s*" | grep -q .; then
- echo " -> Folder starting with 's' already exists. Skipping."
- else
- echo " -> No 's*' folder found. Creating 'Season 1'..."
- mkdir -p "$dir/Season 1"
- # Move files only (not directories) into the new folder
- find "$dir" -maxdepth 1 -type f -exec mv {} "$dir/Season 1"/ \;
- echo " -> Files moved to $dir/Season 1"
- fi
- done
- echo "Done."
Advertisement
Add Comment
Please, Sign In to add comment