Skip to content

Instantly share code, notes, and snippets.

@maiquelleonel
Created June 13, 2015 13:28
Show Gist options
  • Select an option

  • Save maiquelleonel/2bf67d2abec9a3d3a364 to your computer and use it in GitHub Desktop.

Select an option

Save maiquelleonel/2bf67d2abec9a3d3a364 to your computer and use it in GitHub Desktop.
#!/bin/bash
pwd=$(pwd)
cd app/imgs
for file in $(ls ./); do
name=(${file//_/ })
new_dir=${name[0]}
new_name=${name[1]}
if [ ! -d $new_dir ]; then
mkdir $new_dir
fi
mv $file $new_dir"/"$new_name
done
cd $pwd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment