I am searching for some folders in my current directory. What I want to do is, move all the files within those directories to another directory. I am using the following command:
find -maxdepth 1 -regex 'myRegexExpHere' | xargs -I file mv file/* Desktop/New\ folder/
But as expected, the '*' is not expanded by xargs, instead searching for a file named * in each folder. What should I do to achieve my aim? Please suggest ways involving the use of xargs only (and not the -exec switch of find), primarily because I have read that using xargs is much more efficient.
find -exec … +is even more efficient than
xargs. And further, it probably doesn't matter—the moves themnselves will most likely be the vast majority of the time.