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

Re: moves dot files to different directory





Gary Turner wrote:
On Fri, 28 Jun 2002 12:23:44 -0500, Derrick 'dman' Hudson wrote:


On Fri, Jun 28, 2002 at 11:21:18AM -0500, Henning, Brian wrote:
| hello all-
| I have the task of moving all my hidden files to another directory. how can
| i select only these files and not the standard files.
| | ls .* doesn't seem to work.

It does (but without "-a" you won't see them), but it includes '.' and
'..' also :-) (you don't want to 'cp -r' those).


ls -ad ~/.[^.]*


(use -d to not get a recursive listing of all the directories)

  ^^^^^^
Thanks, dman.  I'd never have thought of that.  That took me to man ls
where I found -A.  Even a blind pig can find an acorn now and then. :)

Excuse me if my comments only duplicate others', my ISP, bless their
numb-nut brains, is up to 30 hours delay in delivering the mail.  Oddly
enough, I don't have the original post in this thread yet. :(

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. :)


--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org



Reply to: