fatexs

Untitled

Nov 24th, 2025
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. #point to the folder containing all your series! careful no error checking!
  4. base_path="/srv/smb/Anime"
  5.  
  6. for dir in "$base_path"/*/; do
  7. # Skip if not a directory
  8. [ -d "$dir" ] || continue
  9.  
  10. echo "Checking: $dir"
  11.  
  12. # Look for subfolder starting with s or S
  13. if find "$dir" -mindepth 1 -maxdepth 1 -type d -iname "s*" | grep -q .; then
  14. echo " -> Folder starting with 's' already exists. Skipping."
  15. else
  16. echo " -> No 's*' folder found. Creating 'Season 1'..."
  17.  
  18. mkdir -p "$dir/Season 1"
  19.  
  20. # Move files only (not directories) into the new folder
  21. find "$dir" -maxdepth 1 -type f -exec mv {} "$dir/Season 1"/ \;
  22.  
  23. echo " -> Files moved to $dir/Season 1"
  24. fi
  25. done
  26.  
  27. echo "Done."
  28.  
Advertisement
Add Comment
Please, Sign In to add comment