Re: moves dot files to different directory

2002-06-28 Thread Bob Proulx
> >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. :)

Or if we are just trying to have fun with one line scripting...

  for i in $(echo '.*');do test -f $i && echo $i; done

And the output of the for...done loop can itself be used as input to
other commands.

  mv $(for i in $(echo '.*');do test -f $i && echo $i; done) /path/dir/

But that might trigger an ARG_MAX limit.  Better to use xargs.

  for i in $(echo '.*');do test -f $i && echo $i; done \
| xargs --no-run-if-empty mv --target-directory /path/dir

Bob


pgp9t5wii7VN3.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread Bob Proulx
> >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


pgpQXUFs2YjT4.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread Derrick 'dman' Hudson
On Fri, Jun 28, 2002 at 07:56:16PM -0400, Brian Nelson wrote:
| Derrick 'dman' Hudson <[EMAIL PROTECTED]> writes:
| > 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 ~/.[^.]*
| 
| From man ls,
| 
|-A, --almost-all
|   do not list implied . and ..

Sure, but if you're trying to test your globbing before running
'cp -ar', it isn't helpful :-).  Of course, 'echo' could also be used
to test the globbing.  :-).

-D

-- 

A perverse man stirs up dissension,
and a gossip separates close friends.
Proverbs 16:28
 
http://dman.ddts.net/~dman/



pgpDzPCNFpAgm.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread Travis Crump



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 [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]




Re: moves dot files to different directory

2002-06-28 Thread Gary Turner
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/'

I'm sure anyone with a clue will improve on this regexp (maybe use \< \>
for words?). I copied/modified this from a "RUTE" example.

Or, script the whole thing with awk.  

#!/bin/bash
for i in $(ls -Ald ~/.[^.]* | grep '^-' | awk '{print $9}');
do
echo $i   #test first
   done

--
gt
It is interesting to note that as one evil empire (generic) fell,
another Evil Empire (tm)  began its nefarious rise. -- gt
Coincidence?  I think not.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: moves dot files to different directory

2002-06-28 Thread Bob Proulx
> > > ls -ad ~/.[^.]*

This is one of the FAQs in fileutils.  Check it out!

  
http://www.gnu.org/software/fileutils/doc/faq/#ls%20-a%20*%20does%20not%20list%20dot%20files

Bob


pgpTmwImw1vEO.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread Brian Nelson
Derrick 'dman' Hudson <[EMAIL PROTECTED]> writes:

> 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 ~/.[^.]*

>From man ls,

   -A, --almost-all
  do not list implied . and ..

-- 
Brian Nelson <[EMAIL PROTECTED]>


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: moves dot files to different directory

2002-06-28 Thread Vineet Kumar
* Steve Juranich ([EMAIL PROTECTED]) [020628 10:49]:
> > ls -ad ~/.[^.]*
> 
> I prefer:
> 
> ls -ad ~/.??*
> 
> 
> Many less keystrokes, but to each his own.

... but not quite the same effect. This shell glob won't catch a file
called, say .g -- it requires 2 characters after the '.' . That's
probably usually good enough, but not quite correct.

Also, the -a isn't required to ls to see the dotfiles if they're
supplied explicitly as in "ls -d .*". I'm not sure why it wasn't working
for $OP.

Another thing to note that's very convenient (and fewer still in the
keystroke count) is 'ls -A', which lists all files (including dotfiles)
except '.' and '..' . Also, since you're not specifying the directories
on the command line to ls, it doesn't expand them by default, so no -d
is necessary either.

good times,
Vineet
-- 
http://www.doorstop.net/
-- 
"Computer Science is no more about computers
than astronomy is about telescopes." -E.W. Dijkstra


pgpKHnMIEfJ58.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread Anthony Campbell
On 28 Jun 2002, Steve Juranich wrote:
> > ls -ad ~/.[^.]*
> 
> I prefer:
> 
> ls -ad ~/.??*
> 
> 
> Many less keystrokes, but to each his own.
> 


Midnight Commander is good for this sort of thing.

AC

-- 
Anthony Campbell - running Linux GNU/Debian (Windows-free zone)
For electronic books on the Assassins and on homeopathy, skeptical 
essays, and over 170 book reviews, go to: http://www.acampbell.org.uk/

Our planet is a lonely speck in the great enveloping cosmic dark. In our
obscurity, in all this vastness, there is no hint that help will come
from elsewhere to save us from ourselves. [Carl Sagan]




-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: moves dot files to different directory

2002-06-28 Thread Steve Juranich
> ls -ad ~/.[^.]*

I prefer:

ls -ad ~/.??*


Many less keystrokes, but to each his own.

--
Stephen W. Juranich [EMAIL PROTECTED]
Electrical Engineering http://students.washington.edu/sjuranic
University of Washingtonhttp://ssli.ee.washington.edu/ssli





-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Re: moves dot files to different directory

2002-06-28 Thread Derrick 'dman' Hudson
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)

-D

-- 

  Your mouse has moved.
   You must restart Windows for your changes to take effect.
 
http://dman.ddts.net/~dman/



pgpWgZUMzAyjH.pgp
Description: PGP signature


Re: moves dot files to different directory

2002-06-28 Thread David Z Maze
"Henning, Brian" <[EMAIL PROTECTED]> writes:
> 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.

Really?  It does for me (or at least 'ls -d .*').  'ls -a' will list
all files, even if their names begin with ..  You want to be a bit
careful trying to do this sort of thing, since both . (the current
directory) and .. (the parent directory) begin with . as well.

-- 
David Maze [EMAIL PROTECTED]  http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
-- Abra Mitchell


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



RE: moves dot files to different directory

2002-06-28 Thread Sean 'Shaleh' Perry

On 28-Jun-2002 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.
> 

try:

find . -name ".*" -print

and go from there.


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



moves dot files to different directory

2002-06-28 Thread Henning, Brian
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.

thanks,
brian


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED] 
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]