I need bash script, these are my files:
./2019-01-11_15-00-29_UTC.mp4
./2019-02-10_17-42-18_UTC.mp4
./2019-01-03_14-45-43_UTC.mp4
./2018-12-24_13-00-32_UTC.mp4
./2018-12-09_19-50-59_UTC.mp4
./2019-01-11_14-51-08_UTC.mp4
./2019-01-06_16-41-54_UTC.mp4
./2019-02-03_10-33-33_UTC.mp4
./2019-02-16_18-21-30_UTC.mp4
wanna make two folder 2018 & 2019 then move files own folder.
I use this code:
ls *.mp4 | awk -F"-" '{print $1}' | while read day file ; do mkdir -p "$day"; mv "$file" "$day"; done
It makes folder but not move