I have an interactive script which works terrific at processing a folder of unsorted files into new directories.
I am wondering how I could modify my script so that( upon execution) it provides an additional labelled summary file on my desktop that lists all of the files in each directory that the script has sorted in reverse alphabetical order.
NB. The script as it stands is executed on an unsorted folder containing (jpg,gif,docx, aif, wav).The script runs and moves all files of type jpg, gif,docx to newly formed directories and everything else gets bumped into a miscellaneous. I would like a summary file on the desktop that lists all of these files in reverse alphabetical order based on the executed sort process that has finalised.
#!/bin/bash
read -p "Good Morning, Please enter your file type name for sorting [ENTER]:" all_extensions
if cd /Users/christopherdorman/desktop
then while read extension
do destination="folder$extension"
mkdir -p "$destination"
mv -v unsorted/*."$extension" "$destination"
done <<< "${all_extensions// /$'\n'}"
mkdir -p foldermisc
if mv -v unsorted/* "foldermisc"
then echo "Good News, the rest of Your files have been successfully processed"
fi
for i in folder*/; do
ls -S "$i" > "${i}filelist"
done
fi