Below are some helpful commands I've used to automate some tasks. They have saved me a massive amount of time.
# Move files into folders with same name
for file in *; do if [[ -f "$file" ]]; then mkdir "${file%.*}"; mv "$file" "${file%.*}"; fi; done
# Move files to parent and delete empty folders
find . -not -type d -print0 | xargs -0J % mv -f % . ; find . -type d -depth -print0 | xargs -0 rm -rf
# set modified date of folders to latest file contained
for d (**/*(DFod)) touch -r $d/*(D.om[1]) -- $d
Always run scripts like this on test data first.