Skip to content

Instantly share code, notes, and snippets.

@gabrielcarbone
Created September 26, 2012 17:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielcarbone/3789523 to your computer and use it in GitHub Desktop.
Save gabrielcarbone/3789523 to your computer and use it in GitHub Desktop.
#!/bin/bash
IFS=$'\n'
for file in `ls -1 *.[jJ][pP][gG] *.[tT][hH][mM] *.[mM][pP][gG] 2>/dev/null`;
do
# Creo el directorio fecha YYYY_MM_DD
fecha=`date -r "$file" +%Y_%m_%d`
# Crear directorio sin error en caso de que exista
mkdir -p ./"$fecha"
# Mover archivo
mv -v ./"$file" ./"$fecha"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment