shithub: img

ref: df600ad1a1ae4fa31cb31d7e359af803da1c3aff
dir: /sdrip/archive.rc/

View raw version
#!/bin/rc

{{ls *.JPG; ls *.HEIC} >[2]/dev/null} | awk -F_ '{
	year=substr($1, 1, 4)
	month=substr($1, 5, 2)
	dirs[sprintf("%s/%s", year, month)] = 1
	printf "mv -n %s %s/img/%s/%s/%s\n", $0, ENVIRON["HOME"], year, month, $0
}
END{
	for(d in dirs)
		printf "mkdir -p %s/img/%s\n", ENVIRON["HOME"], d
}' | tac