My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

42 lignes
1.0 KiB

  1. #!/usr/bin/env sh
  2. # Description: Batch rename selection or current directory with qmv
  3. #
  4. # Notes:
  5. # - Try to mimic current batch rename functionality but with correct
  6. # handling of edge cases by qmv or vidir.
  7. # Qmv opens with hidden files if no selection is used. Selected
  8. # directories are shown.
  9. # Vidir don't show directories nor hidden files.
  10. #
  11. # Shell: POSIX compliant
  12. # Author: José Neder
  13. selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
  14. if command -v qmv >/dev/null 2>&1; then
  15. batchrenamesel="qmv -fdo -da"
  16. batchrename="qmv -fdo -a"
  17. elif command -v vidir >/dev/null 2>&1; then
  18. batchrenamesel="vidir"
  19. batchrename="vidir"
  20. else
  21. printf "there is not batchrename program installed."
  22. exit
  23. fi
  24. if [ -s "$selection" ]; then
  25. printf "rename selection? "
  26. read -r resp
  27. fi
  28. if [ "$resp" = "y" ]; then
  29. # -o flag is necessary for interactive editors
  30. xargs -o -0 $batchrenamesel < "$selection"
  31. elif [ ! "$(LC_ALL=C ls -a)" = ".
  32. .." ]; then
  33. # On older systems that don't have ls -A
  34. $batchrename
  35. fi