Bash mv Command – Move Subdirectories Within the Same Directory

bashmv

There is a directory dir/. It contains subdirectories az. I need to move subdirectories ay into subdirectory z.
If that's hard, then not az, but by providing a list of directories that need to be moved.

How can I do this in bash?

Best Answer

As for me more secure way to use find

find dir/* -prune -type d -name "[a-y]" ! -name "z" -exec mv -t dir/z {} +
Related Question