Shell Scripting Knowledge Base
Make folders using filenames, rename files to index.php
and move them to new folder
#!/bin/bash for i in *.php do DIRNAME="$(basename $i .php)" if [[ $DIRNAME != 'index' ]] then mkdir -pv $DIRNAME mv -v $i $DIRNAME/index.php fi done