A nifty find one liner

What this does

This find command finds and moves all directories to /dest/dir that matches the 'dirnamepattern'.

'dirnamepattern' could be aws, go or tmp, or whatever.

Actual command

find . -type d -name '*dirnamepattern*' -exec mv -t /dest/dir {} +

Test before try

I'm not sure if there's a dry run to find's exec, but the above command can be modified to output matching directories with a simple echo variation:

find . -type d -name '*dirnamepattern*' -exec echo {} +

links

social