I am trying to group all the subdirectories with the same names to a new directory (create if not present)using awk
I appreciate any help! Thanks
I am trying to group all the subdirectories with the same names to a new directory (create if not present)using awk
I appreciate any help! Thanks
I'd use a simple for loop like this:
for dir in ./*_*/; do
echo mkdir -p "${dir%%_*}" &&
echo mv "$dir"* "${dir%%_*}" &&
echo rm -r "$dir"
done
If its output looks good, remove echo
es.