summaryrefslogtreecommitdiffstats
path: root/sort-images
blob: b187301efb870c3928a253f966d133998a889b35 (plain)
1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh

perl-rename -v 'BEGIN{use Image::ExifTool qw(ImageInfo); use Date::Parse; use Date::Format;}; $data = ImageInfo($_); $date = time2str("%Y-%m-%d", str2time($data->{ModifyDate})); $_ = "$date/$_";' "$@"

# the same in slow
#for i in "$@"; do 
  #[[ -d "$i" ]] && continue
  #dir=$(exiftool "$i" | grep "File Modification Date/Time" | sed -rn "s/.*: ([0-9]{4}):([0-9]{2}):([0-9]{2}) .*/\1-\2-\3/p")
  #mkdir -p "$dir"
  #mv -nv "$i" "$dir/$(basename "$i")"
#done