ディレクトリ内のファイル名を一括で変更 シェルスクリプト

 
#!/bin/bash

files="/var/www/resources/*"
fileary=()
dirary=()
for filepath in $files;  do
    if [ -f $filepath ] ; then
      fileary+=("$filepath")
      echo ${filepath}
      mv ${filepath} ${filepath}".png"

    elif [ -d $filepath ] ; then
      dirary+=("$filepath")
    fi
done 

Categories:

Tags: