[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: moves dot files to different directory



> >To ignore . and .., use -A (almost all).  I also figured that
> >directories weren't needed, so grepped for regular files.  Then used sed
> >to print only the 9th word.
> >
> >ls -Ald ~/.??* | grep '^-' | sed 's/^\([^ ]*[ ]*\)\{8,8\}\([^ ]*\)/\2/'
> 
> ls -Ald ~/.[^.]* | grep '^-' | tr -s ' ' | cut -d' ' -f9
> It is not that much shorter, but it sure is prettier at least to my eyes. :)

I prefer find myself.

  find . -maxdepth 1 -type f -name '.*' -print

Or, as the original question was how to move all hidden files to a
different directory, this is one way.

  find . -maxdepth 1 -type f -name '.*' -print0 \
    | xargs -0 --no-run-if-empty mv --target-directory /path/to/dir

Bob

Attachment: pgpzAu7XU5sCn.pgp
Description: PGP signature


Reply to: