daily pastebin goal
5%
SHARE
TWEET

Untitled

a guest Sep 19th, 2017 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. shopt -s globstar
  3.  
  4. for file in ./**; do
  5.   if [[ -f $file ]]; then
  6.     IFS=. read -r -d / -a parts <<< "${file##*/}/"
  7.     for i in "${!parts[@]}"; do
  8.       if [[ ${parts[i]} != *[![:alpha:]]* ]]; then
  9.         parts[i]=${parts[i]:0:1}
  10.       fi
  11.     done
  12.     printf -v newname %s. "${parts[@]}"
  13.     echo mv "$file" "${file%/*}/${newname%.}"
  14.   fi
  15. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top