0

I'm using bash shell on Mac 10.9.5. Within a certain directory, how do I move all non-hidden files -- taht is, all those that don't start witih a "."?

Thanks, - Dave

Dave
  • 23
  • Use the file mask [^.]*, as in mv [^.]* {TargetDir}/. Normally, * itself is sufficient, but the more elaborate mask takes account of any settings that may cause the display of hidden files. – AFH Jul 13 '15 at 22:26

1 Answers1

0

Under normal circumstances * will expand to all files except those beginning with .; however, if the dotglob parameter is set, hidden files will also be expanded, as described in this answer. To be sure of excluding hidden files under all circumstances use:

mv [^.]* {TargetDir}/

Here [^.] (or the alternative [!.]) matches any single character other than ., and * matches any number of arbitrary characters (including the empty string).

AFH
  • 17,530