On 04/12/2012 07:53 AM, Chris Jones wrote: > On Wed, Apr 11, 2012 at 10:49:41PM EDT, Eric Blake wrote: > >> tag 11228 notabug >> thanks >> >> On 04/11/2012 06:13 PM, dfm wrote: > > [..] > >> Indeed - POSIX requires that file names beginning with '.' do not >> match a glob starting with '*'; if you want to list such files, you >> have to explicitly match the leading dot. > > Is there any way you can list dot & non-dot files whose names share > a pattern in one pass: > > | $ tree -a /tmp/z > | /tmp/z/ > | ├── bk > | ├── .bk > | ├── .bkn > | └── bkx > > Or move, copy, delete, etc. > > I tend to do stuff like: > > | $ find /tmp/z -name '*bk*' -ls > | $ mv $(find /tmp/z1 -name '*bk*') /tmp/z2 .. etc. > > But that's hardly elegant and since things can get rather complicated, > it could even prove dangerous when you're doing something potentially > destructive.
I usually do the above with something like: (shopt -s dotglob; mv /tmp/z1/*bz* /tmp/z2) Note find is more general for scripts etc. as it can deal with an arbitrary amount of files, but only when used in the form: find /tmp/z1 -name '*bk*' -print0 | xargs -r0 mv -t /tmp/z2 > P.S. Just following up on the existing thread but this hardly belongs to > this mailing list. Is there a help-coreutils for issues that are not > related to a suspected bug? Well we don't really have a help-coreutils, but the general coreutils discussion list is: [email protected] cheers, Pádraig.
