Skip to content

Sort files by date created, date modified, content created (EXIF)

Notifications You must be signed in to change notification settings

star-bits/sort-into-subfolders

Repository files navigation

Sort files into subfolders

Move the .sh file into the folder containing the files to be sorted. Navigate to the folder using Terminal.

Sort by date created

Run shell script:

sh sort-by-created.sh

Or directly in Terminal:

for f in *; do
    dir=$(stat -f%SB -t%Y-%m-%d "$f")
    echo $f '->' $dir
    [ -d "$dir" ] || mkdir "$dir"
    mv "$f" "$dir"/
done

Sort by date modified

Run shell script:

sh sort-by-modified.sh

Or directly in Terminal:

for f in *; do
    dir=$(stat -f%Sm -t%Y-%m-%d "$f")
    echo $f '->' $dir
    [ -d "$dir" ] || mkdir "$dir"
    mv "$f" "$dir"/
done

Sort by content created (EXIF metadata)

Install exiftool

Run shell script:

sh sort-by-exif.sh

Or directly in Terminal:

exiftool -d %Y-%m-%d "-directory<datetimeoriginal" $PWD

About

Sort files by date created, date modified, content created (EXIF)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages