[comp.unix.shell] copying files

nichols@en.ecn.purdue.edu (Scott P Nichols) (12/05/90)

OK, let me restate my question, as none of the answers 
I recieved last time worked...

Here is a listing of my home directory...
(I use csh)  

% ls -la

total 92
drwxr-xr-x 10 nichols      1024 Dec  4 16:52 .
drwxr-xr-x312 root         6144 Nov 25 17:14 ..
-rw-------  1 nichols      1837 Dec  4 09:49 .cshrc
drwx------  2 nichols      1024 Dec  4 16:42 .elm
-rwxr--r--  1 nichols         0 Oct 19 01:35 .hushlogin
-rw-r--r--  1 nichols        26 Dec  1 14:30 .informrc
>>>>>>>>>>>>>>>>> other .files excluded <<<<<<<<<<<<<<<
drwx------  2 nichols      1024 Dec  4 08:37 Mail
drwx------  5 nichols      1024 Dec  2 18:59 News
>>>>>>>>>>>>>>> other directories excluded <<<<<<<<<<<<<<

Do any of you UNIX wizards know how to even list all of
the names of the files which begin '.' (besides, of course
the files in the root (second line of list) 

When I type...                I get...
______________                ________

ls .*                         all of the dot files, then all files
                              in my directory and the previous.

ls .**                        all of the dot files, then all files
                              from the previous directory

ls * .???                     all files in all of my directories

Any other suggestions?

Scott
-- 
O-        /\
|\     /\/vv\
      /vv\   \        	      __Insight from Oregon...Scott P. Nichols
_____/    \   ~~~~~~~~~~~~~~~~                      (nichols@en.ecn.purdue.edu)

rouben@math13.math.umbc.edu (Rouben Rostamian) (12/05/90)

In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
|
|OK, let me restate my question, as none of the answers 
|I recieved last time worked...
|
|Do any of you UNIX wizards know how to even list all of
|the names of the files which begin '.' (besides, of course
|the files in the root (second line of list) 
|

Try
	ls -d .*

--

rajeshg@diamond.tamu.edu (Rajesh Godbole) (12/05/90)

how about :
alias lh 'ls -Fl \!* .[0-Z]* | page'

Rajesh Godbole,				|  preferred: rajeshg@diamond.tamu.edu
System Admin., Dept. of Ag. Engg.	|  otherwise: godbole@eemips.tamu.edu
Texas A&M University, College Station.	|  home:(409) 846-1969; off: ..845-6484
------------------------------------------------------------------------------

subbarao@phoenix.Princeton.EDU (Kartik Subbarao) (12/05/90)

>Here is a listing of my home directory...

[listing deleted]
>
>ls .*                         all of the dot files, then all files
>                              in my directory and the previous.

This is, as someone I know would say, something else that's wrong with csh.
(Right Paul? Of course any shell he'd write wouldn't have that problem :-))

The problem with a simple .* is that "." and ".." also qualify as .*'s,
and as you know, they stand for your current and parent directories.

>Any other suggestions?

Sure - try :

ls .[A-z]*

This should find most of the files you want. The only problems with this
are if you have directories that begin with a "." (i.e .NeXT), and files
that for some reason are outside the range of A-z and that you would like
to list. 


			-Kartik


(I need a new .signature -- any suggestions?)
subbarao@{phoenix or gauguin}.Princeton.EDU -|Internet
kartik@silvertone.Princeton.EDU (NeXT mail)       -|	
SUBBARAO@PUCC.BITNET			          - Bitnet

bonnett@seismo.CSS.GOV (H. David Bonnett) (12/05/90)

Try cp .??* <dest>

This will mask off the root and current directory but match any filename
of three letters or more.
To get any directories with a leading . use cp -r .??* <dest>

-dave bonnett; Center for Seismic Studies.
      bonnett@seismo.css.gov  -

emv@ox.com (Ed Vielmetti) (12/06/90)

In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:

   Do any of you UNIX wizards know how to even list all of
   the names of the files which begin '.' (besides, of course
   the files in the root (second line of list) 

I usually use .??*, which works unless you have a file like ".a" or
".Z". 

--Ed

shwake@raysnec.UUCP (Ray Shwake) (12/06/90)

rouben@math13.math.umbc.edu (Rouben Rostamian) writes:

>In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
>|
>|Do any of you UNIX wizards know how to even list all of
>|the names of the files which begin '.' (besides, of course
>|the files in the root (second line of list) 
>|

>Try
>	ls -d .*

	For some users on some systems, this will list both current directory
(.) and parent directory (..), which is not what is required. Try instead:

	ls -d .??*

dberg@informix.com (David I. Berg) (12/06/90)

In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
>Do any of you UNIX wizards know how to even list all of
>the names of the files which begin '.' (besides, of course
>the files in the root (second line of list) 

ls .[a-zA-Z1-9]*

  ___                   ___
  /  ) __      . __/    /_ ) _       __   David Berg (dberg@cougar.informix.com)
_/__/ (_(_ (/ / (_(_  _/__> (-' -/~ (_/   Informix Software, Inc.
                                    _/    5299 DTC Boulevard, Suite 740
                                          Englewood, CO 80111     (303) 850-0210

The opinions expressed herein do not necessarily reflect those of Informix, Inc.

chris@mimsy.umd.edu (Chris Torek) (12/07/90)

>In article <1990Dec5.021951.28104@en.ecn.purdue.edu>
 nichols@en.ecn.purdue.edu (Scott P Nichols) asks how to match `.*' without
 matching . and .. (in essence, anyway).

In various articles various people give incorrect and/or incomplete answers.
One of the best answers is:

In article <EMV.90Dec5104011@crane.aa.ox.com> emv@ox.com (Ed Vielmetti) writes:
>I usually use .??*, which works unless you have a file like ".a" or
>".Z". 

This is correct.  `.??*' matches all files where:
	- the name begins with `.', and
	- the name contains at least three characters
Since there is only one file that has one character and begins with `.',
namely `.', all that is left are the two-character files whose name begins
with `.'.  You want all but `..'.  If any such files exist, the pattern

	.[^A--/-^?]

will match them.  Note: ^A here represents a literal control-A, and
^? represents either a literal DEL (if you have only 7-bit shells and
files) or meta-DEL (if you have 8-bit shells and files).

Since it is generally not desirable to pass the pattern on if no files
match (as is normal under sh and occurs when you `set nonomatch' in
csh), you should use

	.[^A--/-^?] .??*

only if you do have two-character-name `.' files.

Alternative solutions using `ls -A' or `ls -a' and/or sed and so forth
are available.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

fenn@wpi.WPI.EDU (Brian Fennell) (12/07/90)

In article <169@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes:
>rouben@math13.math.umbc.edu (Rouben Rostamian) writes:
>
>>In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
>>|
>>|Do any of you UNIX wizards know how to even list all of
>>|the names of the files which begin '.' (besides, of course
>>|the files in the root (second line of list) 
>>|
>
>>Try
>>	ls -d .*
>
>	For some users on some systems, this will list both current directory
>(.) and parent directory (..), which is not what is required. Try instead:
>
>	ls -d .??*

ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `

sheeeeeesh

merlyn@iwarp.intel.com (Randal Schwartz) (12/08/90)

In article <1990Dec6.230153.14856@wpi.WPI.EDU>, fenn@wpi (Brian Fennell) writes:
| In article <169@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes:
| >rouben@math13.math.umbc.edu (Rouben Rostamian) writes:
| >
| >>In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
| >>|
| >>|Do any of you UNIX wizards know how to even list all of
| >>|the names of the files which begin '.' (besides, of course
| >>|the files in the root (second line of list) 
| >>|
| >
| >>Try
| >>	ls -d .*
| >
| >	For some users on some systems, this will list both current directory
| >(.) and parent directory (..), which is not what is required. Try instead:
| >
| >	ls -d .??*
| 
| ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
| 
| sheeeeeesh

OK, I'll take that as a challenge.  Here it is in one less process,
and *without* the shell globbing getting in the way:

ls -dl `ls -a | egrep -v '^([^.].*|\.\.?)$'`

(Don't have the shell see a wildcard unless you want the shell to glob it.)

Just another Unix hacker,
-- 
/=Randal L. Schwartz, Stonehenge Consulting Services (503)777-0095 ==========\
| on contract to Intel's iWarp project, Beaverton, Oregon, USA, Sol III      |
| merlyn@iwarp.intel.com ...!any-MX-mailer-like-uunet!iwarp.intel.com!merlyn |
\=Cute Quote: "Intel: putting the 'backward' in 'backward compatible'..."====/

djc@Kesa.COM (Don Christensen) (12/08/90)

chris@mimsy.umd.edu (Chris Torek) writes:

>>In article <1990Dec5.021951.28104@en.ecn.purdue.edu>
> nichols@en.ecn.purdue.edu (Scott P Nichols) asks how to match `.*' without
> matching . and .. (in essence, anyway).

>In article <EMV.90Dec5104011@crane.aa.ox.com> emv@ox.com (Ed Vielmetti) writes:
>>I usually use .??*, which works unless you have a file like ".a" or
>>".Z". 

>with `.'.  You want all but `..'.  If any such files exist, the pattern

>	.[^A--/-^?]

>will match them.  Note: ^A here represents a literal control-A, and
>^? represents either a literal DEL (if you have only 7-bit shells and
>files) or meta-DEL (if you have 8-bit shells and files).

I typically use .??* because it is the easiest to type and I have rarely
(never?) come across a two character `.' file.  It seems to me, though,
that the shortest way to get all `.' files excluding `.' and `..' is
with the following expression:

ls -d .[^.]*


Don
-- 
Don Christensen  <=> djc@kesa.com     <=> "Ashes and diamonds, foe and friend;
Kesa Corporation <=> ...!mips!kesa!djc <=> they are all equal in the end."
Santa Clara, CA  <=> ...!daver!kesa!djc <=>                      -- Pink Floyd

rob@b15.INGR.COM (Rob Lemley) (12/08/90)

In <4497@idunno.Princeton.EDU> subbarao@phoenix.Princeton.EDU (Kartik Subbarao) writes:

>The problem with a simple .* is that "." and ".." also qualify as .*'s,
>and as you know, they stand for your current and parent directories.

>ls .[A-z]*

How about:

	ls -d .[!.]*	# sys V R 3 sh and ksh

Rob
---
Rob Lemley
System Consultant, Scanning Software, Intergraph, Huntsville, AL
rob!b15@ingr.com		OR		...!uunet!ingr!b15!rob
205-730-1546

peter@ficc.ferranti.com (Peter da Silva) (12/08/90)

In article <1990Dec5.224655.29706@informix.com> dberg@informix.com (David I. Berg) writes:
> In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
> >Do any of you UNIX wizards know how to even list all of
> >the names of the files which begin '.' (besides, of course
> >the files in the root (second line of list) 
> 
> ls .[a-zA-Z1-9]*

% touch .,
% ls .[a-zA-Z1-9]*
% ls -a
.
..
.,
%

I'm not sure what the original poster meant to ask. I assume it was "how to
list all files but . and ..". We've had flame wars about this before. I think
something like ".[^.]*" will work. If you're not sure the safest thing to do
is...

% ls -ad | sed -e '/^\.$/d' -e '/^\.\.$/d'
.,
%

In practice, I find that ".??*" is the quickest pattern to type that gets
most of them.
-- 
Peter da Silva.   `-_-'
+1 713 274 5180.   'U`
peter@ferranti.com 

jhi@hila.hut.fi (Jarkko Hietaniemi) (12/08/90)

> nichols@en.ecn.purdue.edu (Scott P Nichols):
> Do any of you UNIX wizards know how to even list all of
> the names of the files which begin '.' (besides, of course
> the files in the root (second line of list) 

ls -d `ls -A|grep '^\.'`

	  ^^
--
Jarkko Hietaniemi <jhi@hut.fi> Helsinki University of Technology, Finland
Ever had one of those lives ?

ires@kaspar.UUCP (Bruce R. Larson) (12/09/90)

In article <1990Dec6.230153.14856@wpi.WPI.EDU>, fenn@wpi.WPI.EDU (Brian Fennell) writes:
> In article <169@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes:
> >rouben@math13.math.umbc.edu (Rouben Rostamian) writes:
> >
> >>In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
> >>|
> >>|Do any of you UNIX wizards know how to even list all of
> >>|the names of the files which begin '.' (besides, of course
> >>|the files in the root (second line of list) 
> >>|
> 
> ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
> 
> sheeeeeesh

Are you guys still talking about this?  Sheeeesh indeed!

Sorry Brian, but did you try your solution?  It lists both `.' and `..'.



The fellow who suggested `ls -ld .*' gave the best non-pipe solution to date.
You can get rid of the `.' entry by listing filenames with at least 2 chars.

   ls -ld .?*

The only undesirable entry remaining is `..'.


If you absolutely *have* to get rid of the `..' you can do this:

    /bin/ls -ld .?* | grep -v ' \.\.$'

[NOTE:  Use /bin/ls or equivalent to avoid aliased ls's and locally
        modified ls's.]

If we don't put this one rest soon we'll start getting awk and perl and
who-knows-what-else solutions.

B

lwall@jpl-devvax.JPL.NASA.GOV (Larry Wall) (12/09/90)

In article <24@kaspar.UUCP> ires@kaspar.UUCP (Bruce R. Larson) writes:
: If we don't put this one rest soon we'll start getting awk and perl and
: who-knows-what-else solutions.

Solutions?  Yikes!  We mustn't have solutions.  Horrors...

Larry Wall
lwall@jpl-devvax.jpl.nasa.gov

dan@maccs.dcss.mcmaster.ca (Dan Trottier) (12/10/90)

>| >>|Do any of you UNIX wizards know how to even list all of
>| >>|the names of the files which begin '.' (besides, of course
>| >>|the files in the root (second line of list) 

The most efficient in terms of starting processes would be the following:

    alias l. 'set dotfiles = `echo .?*` ; echo $dotfiles[2-]'

So typing "l." would give a short list of all . files in a directory and
typing "ls -l $dotfiles[2-]" would give you the long format.

dan
-- 
Dan Trottier                                       dan@maccs.dcss.McMaster.CA
Dept of Computer Science                       ...!uunet!utai!utgpu!maccs!dan
McMaster University                                      (416) 525-9140 x3444

john@nereid.jpl.nasa.gov (John Veregge) (12/11/90)

In article <24@kaspar.UUCP>, ires@kaspar.UUCP (Bruce R. Larson) writes:
|> In article <1990Dec6.230153.14856@wpi.WPI.EDU>, fenn@wpi.WPI.EDU (Brian Fennell) writes:
|> > In article <169@raysnec.UUCP> shwake@raysnec.UUCP (Ray Shwake) writes:
|> > >rouben@math13.math.umbc.edu (Rouben Rostamian) writes:
|> > >
|> > >>In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
|> > >>|
|> > >>|Do any of you UNIX wizards know how to even list all of
|> > >>|the names of the files which begin '.' (besides, of course
|> > >>|the files in the root (second line of list) 
|> > >>|
|> > 
|> > ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
|> > 
|> > sheeeeeesh
|> 
|> Are you guys still talking about this?  Sheeeesh indeed!
|> 
|> Sorry Brian, but did you try your solution?  It lists both `.' and `..'.
|> 
|> 
|> 
|> The fellow who suggested `ls -ld .*' gave the best non-pipe solution to date.
|> You can get rid of the `.' entry by listing filenames with at least 2 chars.
|> 
|>    ls -ld .?*
|> 
|> The only undesirable entry remaining is `..'.
|> 
|> 
|> If you absolutely *have* to get rid of the `..' you can do this:
|> 
|>     /bin/ls -ld .?* | grep -v ' \.\.$'
|> 
|> [NOTE:  Use /bin/ls or equivalent to avoid aliased ls's and locally
|>         modified ls's.]
|> 
|> If we don't put this one rest soon we'll start getting awk and perl and
|> who-knows-what-else solutions.
|> 
|> B

I have found the following work quite well ... (But alas, I never tried them
on anything but our Suns.)

	sh:	echo .[!.]*		OR	ls -ad .[!.]*
	csh:	echo .[\ --/-~]*	OR	ls -ad .[\ --/-~]*

	The bourne shell allows an enclosed pattern specification of
	"any character but these" with [! ... ]. The c shell apparently
	does not (and I looked real hard {-:).

	The c shell enclosed pattern specification is "any character from
	the space (escaped) character to the minus sign character OR from
	the slash character to the tilde character." The specification is
	missing only one ascii printing character, the period character.

-- 
John R Veregge                 Section 348 - Flight Command and Data
Jet Propulsion Laboratory      Management (Technology Development)
Calif Institute of Technology  Mail stop: T1704, Office: T1704-P
4800 Oak Grove Drive           Phone: (818) 354-0511, FAX: 393-4494
Pasadena, CA, USA 91109        john@triton.jpl.nasa.gov

tchrist@convex.COM (Tom Christiansen) (12/11/90)

In article <4914@mahendo.Jpl.Nasa.Gov> john@nereid.jpl.nasa.gov (John Veregge) writes:
>	The bourne shell allows an enclosed pattern specification of
>	"any character but these" with [! ... ]. The c shell apparently
>	does not (and I looked real hard {-:).

The ! syntax for exclusion isn't very much in line with other regexps.
The tcsh allows *.[^ao] for all the *.? where ? is not a or o.

--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
 to look at yourself in the mirror the next morning."  -me

chet@odin (Chet Ramey) (12/11/90)

In article <110253@convex.convex.com> tchrist@convex.COM (Tom Christiansen) writes:

>The ! syntax for exclusion isn't very much in line with other regexps.
>The tcsh allows *.[^ao] for all the *.? where ? is not a or o.

The Bourne and Korn shells support it, as do bash and ash.  It has been
blessed by Posix.

Chet
-- 
Chet Ramey				``I die, Horatio''
Network Services Group, Case Western Reserve University
chet@ins.CWRU.Edu
                My opinions are just those, and mine alone.

tchrist@convex.COM (Tom Christiansen) (12/12/90)

In article <1990Dec11.125018.12274@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes:
:In article <110253@convex.convex.com> I wrote:
:>The ! syntax for exclusion isn't very much in line with other regexps.
:>The tcsh allows *.[^ao] for all the *.? where ? is not a or o.

:The Bourne and Korn shells support it, as do bash and ash.  It has been
:blessed by Posix.

Which one, the bang one!!??  That's really idiotic if so, and it hasn't
been voted on yet.  If the ^ one, then great, that's very unusally 
forward thinking of them; nice to see them do something that actually
looks like other things in UNIX for a change.

Which it it?  Do I get to flame or cheer?

--tom
--
Tom Christiansen		tchrist@convex.com	convex!tchrist
"With a kernel dive, all things are possible, but it sure makes it hard
 to look at yourself in the mirror the next morning."  -me

maart@cs.vu.nl (Maarten Litmaath) (12/13/90)

In article <110398@convex.convex.com>,
	tchrist@convex.COM (Tom Christiansen) writes:
)In article <1990Dec11.125018.12274@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes:
):In article <110253@convex.convex.com> I wrote:
):>The ! syntax for exclusion isn't very much in line with other regexps.
):>The tcsh allows *.[^ao] for all the *.? where ? is not a or o.
)
):The Bourne and Korn shells support it, as do bash and ash.  It has been
):blessed by Posix.
)
)Which one, the bang one!!??  That's really idiotic if so, and it hasn't
)been voted on yet.  If the ^ one, then great, that's very unusally 
)forward thinking of them; nice to see them do something that actually
)looks like other things in UNIX for a change.
)
)Which it it?  Do I get to flame or cheer?

You get both.  Cheers because you'd prefer `^', flames because the `!' is
_existing_ practice (in System V).  Why was it chosen in the first place?
Well, the `^' is an ancient synonym for `|'!  Try it out yourself!

It's been a mistake in the first place to allow 3 different pattern
matching/file globbing syntaxes to be developed, but such is life.
--
In the Bourne shell syntax tabs and spaces are equivalent almost everywhere.
The exception: _indented_ here documents.  :-(
Does anyone remember the famous mistake Makefile-novices often make?

Ray.Nickson@comp.vuw.ac.nz (Ray Nickson) (12/13/90)

In article <2763ACE5.12204@maccs.dcss.mcmaster.ca> dan@maccs.dcss.mcmaster.ca (Dan Trottier) writes:

   >| >>|Do any of you UNIX wizards know how to even list all of
   >| >>|the names of the files which begin '.' (besides, of course
   >| >>|the files in the root (second line of list) 

   The most efficient in terms of starting processes would be the following:

       alias l. 'set dotfiles = `echo .?*` ; echo $dotfiles[2-]'

$ mkdir foo
$ touch .a .xyz
$ set dotfiles = `echo .?*`; echo $dotfiles[2-]
[2-]

... oops, he means the CrackedShell ...

$ csh
% set dotfiles = `echo .?*`; echo $dotfiles[2-]
.a .xyz

... looks ok, but ...
% touch .-
% set dotfiles = `echo .?*`; echo $dotfiles[2-]
.. .a .xyz

Problem: . and .. don't necessarily come first in a (sorted) directory
listing!

-rgn
--
Ray Nickson <Ray.Nickson@comp.vuw.ac.nz>                    + 64 4 721000x8144
                      "Winter in water colours"

tin@smsc.sony.com (Tin Le) (12/14/90)

In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
>
>OK, let me restate my question, as none of the answers 
>I recieved last time worked...
>
>Here is a listing of my home directory...
>(I use csh)  
>
>% ls -la
>
>total 92
>drwxr-xr-x 10 nichols      1024 Dec  4 16:52 .
>drwxr-xr-x312 root         6144 Nov 25 17:14 ..
>-rw-------  1 nichols      1837 Dec  4 09:49 .cshrc
>drwx------  2 nichols      1024 Dec  4 16:42 .elm
>-rwxr--r--  1 nichols         0 Oct 19 01:35 .hushlogin
>-rw-r--r--  1 nichols        26 Dec  1 14:30 .informrc
>>>>>>>>>>>>>>>>>> other .files excluded <<<<<<<<<<<<<<<
>drwx------  2 nichols      1024 Dec  4 08:37 Mail
>drwx------  5 nichols      1024 Dec  2 18:59 News
>>>>>>>>>>>>>>>> other directories excluded <<<<<<<<<<<<<<
>
>Do any of you UNIX wizards know how to even list all of
>the names of the files which begin '.' (besides, of course
>the files in the root (second line of list) 
>
>When I type...                I get...
>______________                ________
>
>ls .*                         all of the dot files, then all files
>                              in my directory and the previous.
>
>ls .**                        all of the dot files, then all files
>                              from the previous directory
>
>ls * .???                     all files in all of my directories
>
>Any other suggestions?


   Since you are using csh, how about some regex?  Try this:

[tin] rn31 242 >/bin/ls .[a-zA-Z0-9]*
.Xdefaults     .jobdir        .oldnewsrc     .rnlast        .xinitrc.rn31
.Xinitrc       .letter        .phones        .rnlock        .xinitrc.save
.article       .login         .plan          .rnsoft
.calendar      .mailrc        .pnewsexpert   .sh_history
.cshrc         .mwmrc         .profile       .signature
.exrc          .newsrc        .rhosts        .twmrc
[tin] rn31 243 >

   Seems to do what you wanted above.

-- Tin

-- 
.----------------------------------------------------------------------
. Tin Le                    Work Internet: tin@smsc.Sony.COM
. Sony Microsystems              UUCP: {uunet,mips}!sonyusa!tin
. Work: (408) 944-4157      Home Internet: tin@szebra.uu.net

bsteinke@es.com (Bruce Steinke) (12/14/90)

In article <1990Dec13.171546.7020@smsc.sony.com>, tin@smsc.sony.com (Tin Le) writes:
|> In article <1990Dec5.021951.28104@en.ecn.purdue.edu> nichols@en.ecn.purdue.edu (Scott P Nichols) writes:
|> >
|> >OK, let me restate my question, as none of the answers 
|> >I recieved last time worked...
|> >
|> >Here is a listing of my home directory...
|> >(I use csh)  
|> >
|> >% ls -la
|> >
|> >total 92
|> >drwxr-xr-x 10 nichols      1024 Dec  4 16:52 .
|> >drwxr-xr-x312 root         6144 Nov 25 17:14 ..
|> >-rw-------  1 nichols      1837 Dec  4 09:49 .cshrc
|> >drwx------  2 nichols      1024 Dec  4 16:42 .elm
|> >-rwxr--r--  1 nichols         0 Oct 19 01:35 .hushlogin
|> >-rw-r--r--  1 nichols        26 Dec  1 14:30 .informrc
|> >>>>>>>>>>>>>>>>>> other .files excluded <<<<<<<<<<<<<<<
|> >drwx------  2 nichols      1024 Dec  4 08:37 Mail
|> >drwx------  5 nichols      1024 Dec  2 18:59 News
|> >>>>>>>>>>>>>>>> other directories excluded <<<<<<<<<<<<<<
|> >
|> >Do any of you UNIX wizards know how to even list all of
|> >the names of the files which begin '.' (besides, of course
|> >the files in the root (second line of list) 
|> >
|> >When I type...                I get...
|> >______________                ________
|> >
|> >ls .*                         all of the dot files, then all files
|> >                              in my directory and the previous.
|> >
|> >ls .**                        all of the dot files, then all files
|> >                              from the previous directory
|> >
|> >ls * .???                     all files in all of my directories
|> >
|> >Any other suggestions?
|> 
|> 
|>    Since you are using csh, how about some regex?  Try this:
|> 
|> [tin] rn31 242 >/bin/ls .[a-zA-Z0-9]*
|> .Xdefaults     .jobdir        .oldnewsrc     .rnlast        .xinitrc.rn31
|> .Xinitrc       .letter        .phones        .rnlock        .xinitrc.save
|> .article       .login         .plan          .rnsoft
|> .calendar      .mailrc        .pnewsexpert   .sh_history
|> .cshrc         .mwmrc         .profile       .signature
|> .exrc          .newsrc        .rhosts        .twmrc
|> [tin] rn31 243 >
|> 
|>    Seems to do what you wanted above.
|> 
|> -- Tin
|> 
|> -- 
|> .----------------------------------------------------------------------
|> . Tin Le                    Work Internet: tin@smsc.Sony.COM
|> . Sony Microsystems              UUCP: {uunet,mips}!sonyusa!tin
|> . Work: (408) 944-4157      Home Internet: tin@szebra.uu.net

How about this alternative (easier to type):

	ls -ad .*	-or-
	ls -ald .*	-long listing-

This works for me...

-Bruce
-- 
  Bruce F. Steinke                  | "And the road goes ever on..."
  bsteinke@dsd.es.com               |  Bilbo Baggins
  Evans & Sutherland Computer Corp. |
  Salt Lake City, Utah              |  No moss under these feet!

spaf@cs.purdue.EDU (Gene Spafford) (12/14/90)

How to list all non . and .. files/directories in the current
directory that start with . without using pipes (Bourne shell or ksh):

ls -ad .[!.] .??*	-or-	 echo .[!.] .??*

Why:  
ls or echo  	(obvious)
-ad on ls	(so we don't list directory contents of .name)
.[!.]		(all 2-character names starting with . EXCEPT ..)
.??*		(all 3+ character names starting with .)

It is permissible in this game to use more than one argument to a
command, is it not?  :-)
-- 
Gene Spafford
NSF/Purdue/U of Florida  Software Engineering Research Center,
Dept. of Computer Sciences, Purdue University, W. Lafayette IN 47907-2004
Internet:  spaf@cs.purdue.edu	uucp:	...!{decwrl,gatech,ucbvax}!purdue!spaf

chris@mimsy.umd.edu (Chris Torek) (12/15/90)

In an article whose referent was deleted by broken news software, I wrote:
>... If any such files exist, the pattern
>	.[^A--/-^?]
>will match them.  Note: ^A here represents a literal control-A, and
>^? represents either a literal DEL (if you have only 7-bit shells and
>files) or meta-DEL (if you have 8-bit shells and files).

In article <1990Dec07.201727.11006@Kesa.COM> djc@Kesa.COM (Don Christensen)
writes:
>I typically use .??* because it is the easiest to type and I have rarely
>(never?) come across a two character `.' file.

(I have one, hence some concern. :-) )

>It seems to me, though, that the shortest way to get all `.' files
>excluding `.' and `..' is with the following expression:
>
>ls -d .[^.]*

This does not work, for several reasons:

	- the syntax given (left-bracket caret period right-bracket)
	  only works in POSIXish shells.  Among those excluded are all
	  of the 4BSD and System V shells except *very* recent work.
	  Some System V shells have an alternative syntax ([!.]).

	- It fails to match names like `..gotcha'.


I typically use `.??*', but for reference, the construct

    foo `ls -f | tail +3`

is also useful (provided your `ls' has a `-f'!).
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

jeff@onion.pdx.com (Jeff Beadles) (12/16/90)

In <12758@medusa.cs.purdue.edu> spaf@cs.purdue.edu (Gene Spafford) writes:

>How to list all non . and .. files/directories in the current
>directory that start with . without using pipes (Bourne shell or ksh):

>ls -ad .[!.] .??*	-or-	 echo .[!.] .??*

Well, this is one of the nicer ones that I've seen, but it won't work on all
systems.  There are several versions of 'sh' out there that don't support
[!pattern].  Unfortunately,  I use one of them. :-)

Script started on Sat Dec 15 08:58:02 1990
jo:jeff> sh
$ cd
$ touch .a .b .c
$ ls -ad .[!.]
..
jo:jeff> exit
script done on Sat Dec 15 08:58:37 1990

Sigh,

	-Jeff
-- 
Jeff Beadles		jeff@onion.pdx.com

acb@erhs40.UUCP (Sander Beenen) (12/17/90)

In article <8492@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>In article <110398@convex.convex.com>,
>	tchrist@convex.COM (Tom Christiansen) writes:
>)In article <1990Dec11.125018.12274@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes:
>):In article <110253@convex.convex.com> I wrote:
>):>The ! syntax for exclusion isn't very much in line with other regexps.
>):>The tcsh allows *.[^ao] for all the *.? where ? is not a or o.
>)
>):The Bourne and Korn shells support it, as do bash and ash.  It has been
>):blessed by Posix.
>
And lot of more F's.
Why just not simply 'ls -a .??*' or 'ls -al .??*'.
-- 
    Sander Beenen  B-)            Uucp: ...!hp4nl!erhs40!acb
  Ericsson Radio Systems B.V.     Inet: acb%erhs40@mcsun.EU.net
   P.O. Box 2015 - 7801 CA        Tel.: +31 5910 37497
   Emmen - The Netherlands        ** Scotty, beep me up **

maart@cs.vu.nl (Maarten Litmaath) (12/18/90)

In article <28626@mimsy.umd.edu>,
	chris@mimsy.umd.edu (Chris Torek) writes:
)...
)>ls -d .[^.]*
)
)This does not work, for several reasons:
)
)	- the syntax given (left-bracket caret period right-bracket)
)	  only works in POSIXish shells.

POSIX 1003.2 Draft 10 does not agree with you, Chris...

)	  Among those excluded are all
)	  of the 4BSD and System V shells except *very* recent work.
)	  Some System V shells have an alternative syntax ([!.]).

...just like the POSIX shell.  POSIX `blessed' the existing practice (*),
that is `!', instead of `^', which would have been more consistent with
the regular expression syntaxes.  But who gives a damn about consistency?

(*) The System V people chose `!' because `^' was an ancient synonym for
the pipe symbol:

	date ^ cat

The shell syntax of POSIX 1003.2 Draft 10 does not mention `^' as an
alternative for `|' (anymore).  Good!
--
In the Bourne shell syntax tabs and spaces are equivalent almost everywhere.
The exception: _indented_ here documents.  :-(
Does anyone remember the famous mistake Makefile-novices often make?

sleepy@wybbs.mi.org (Mike Faber) (12/18/90)

>>OK, let me restate my question, as none of the answers 
>>I recieved last time worked...
>>
>>Here is a listing of my home directory...
>>(I use csh)  
>>
>>% ls -la
blah blah blah...

>>Do any of you UNIX wizards know how to even list all of
>>the names of the files which begin '.' (besides, of course
>>the files in the root (second line of list) 

Let's not get too sophistcated here, how about:

ls -ld .*

Maybe, Just Maybe?

--
Michael Faber
sleepy@wybbs.UUCP

msf@rotary.Central.Sun.COM (Mike Fischbein) (12/18/90)

To list all the .* files except for . and .. why not use the standard
ls option -A, viz:

ls -Ad .*

		mike

--
Michael Fischbein,  Technical Consultant, Sun Professional Services
Sun Albany, NY  518-783-9613  sunbow!msf or mfischbein@east.sun.com
These are my opinions and not necessarily those of any other person
or organization.                                    Save the skeet!

chet@odin (Chet Ramey) (12/18/90)

In article <8525@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:

>...just like the POSIX shell.  POSIX `blessed' the existing practice (*),
>that is `!', instead of `^', which would have been more consistent with
>the regular expression syntaxes.  But who gives a damn about consistency?

It is sort of consistent, in a twisted sort of way.  Everywhere in the
shell that `not' is needed, `!' is used:  to invert the return value of
a pipeline, to negate a test in the `test' command (which is pretty much
assumed to be built in), and to negate a pattern in file name generation.

Chet
-- 
Chet Ramey				``I die, Horatio''
Network Services Group, Case Western Reserve University
chet@ins.CWRU.Edu
                My opinions are just those, and mine alone.

chris@mimsy.umd.edu (Chris Torek) (12/20/90)

[me]
>>	- caret ... only works in POSIXish shells.

In article <8525@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>POSIX 1003.2 Draft 10 does not agree with you, Chris...

Oops.  (Excuse: I do not have any POSIX drafts.)

Make that `only works in shells with sane RE syntax' :-)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

bob@wyse.wyse.com (Bob McGowen x4312 dept208) (12/21/90)

In article <1990Dec18.155945.10089@usenet.ins.cwru.edu> chet@po.CWRU.Edu writes:
>In article <8525@star.cs.vu.nl> maart@cs.vu.nl (Maarten Litmaath) writes:
>
>>...just like the POSIX shell.  POSIX `blessed' the existing practice (*),
>>that is `!', instead of `^', which would have been more consistent with
>>the regular expression syntaxes.  But who gives a damn about consistency?

It was already inconsistent.  In grep et al a dot refers to a single
character, an * repeats the preceding character 0 or more times.
The shell uses ? for a single character and * means 0 or more of any
character at that position...  In any case there are several areas where
the shell differs from good ol' grep type RE's.  And as Maarten notes, it
IS consistent within itself.

>
>It is sort of consistent, in a twisted sort of way.  Everywhere in the
>shell that `not' is needed, `!' is used:  to invert the return value of


Bob McGowan  (standard disclaimer, these are my own ...)
Product Support, Wyse Technology, San Jose, CA
.!uunet!wyse!bob
bob@wyse.com

saddler@bcstec.boeing.com (Ray Saddler) (12/22/90)

In article <1990Dec6.230153.14856@wpi.WPI.EDU> (Brian Fennell) suggests:
.In article <169@raysnec.UUCP> (Ray Shwake) replies:
..rouben@math13.math.umbc.edu (Rouben Rostamian) proposes:
..
...In article <1990Dec5.021951.28104@en.ecn.purdue.edu> (Scott P Nichols) asks:
....
....Do any of you UNIX wizards know how to even list all of
....the names of the files which begin '.' (besides, of course
....the files in the root (second line of list) 
....
..
...Try
...	ls -d .*
..
..	For some users on some systems, this will list both current directory
..(.) and parent directory (..), which is not what is required. Try instead:
..
..	ls -d .??*
.
.ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
.

I use the simple command: ls -al .??*

...works for me...
-- 
Ray E. Saddler III                 UseNet            ___ ___ ___ ___     ___
CAD System/Network Admin   ..!uunet!bcstec!saddler  /__//  //__  /  /\ //  _
P.O. Box 3999 m.s. 3R-05          PhoneNet         /__//__//__ _/_ /  //__/
Seattle, WA.  98124  USA      +1 206-657-2824      Missile Systems Division

yakker@ucrmath.ucr.edu (matt robinson) (12/22/90)

Ray Saddler writes:
->Brian Fennell suggests:
->.Ray Shwake replies:
->..Rouben Rostamian proposes:
->...Scott P Nichols asks:
->....
->....Do any of you UNIX wizards know how to even list all of
->....the names of the files which begin '.' (besides, of course
->....the files in the root (second line of list) 
->....
->...Try ->...	ls -d .*
->..
->..	For some users on some systems, this will list both current directory
->..(.) and parent directory (..), which is not what is required. Try instead:
->..
->..	ls -d .??*
->.
->.ls -dal `ls -da .* | grep -v '^\.$' | grep -v '^\.\.$' `
->
->I use the simple command: ls -al .??*

What's the subject here?  Is this the "my ls command is better than your ls
command will ever be" week?  A simple way to do an ls of all dot files in the
current directory (excluding the ./ and ../), is

	ls -Al .??*

and for files with the ./ and ../, use

	ls -dla .*

So, you try this out, or try any of the other umpteen billion posts to this
answer, and I'm sure ONE of them will work.

But, the title said "copying files".  For copy, of most kinds, I've learned
that man's best friend is "tar", and "cpio" (your own flavor).  Why would you
discuss file listings with this topic? (Sigh).  Anyone want to change the
present thread?

--Matt

______________________________________________________________________________
Matt D. Robinson                                 "...if I only had a brain..."
Systems Programming Group, UC Riverside     -- The Scarecrow, The Wizard Of Oz
Internet : yakker@ucrmath.ucr.edu       UUCP : ..!ucsd!ucrmath!{yakker,source}

yakker@ucrmath.ucr.edu (matt robinson) (12/23/90)

As pointed out to me by chris@cs.UMD.EDU, I made a slight mistake.  What
I should have said was (for showing dot files without ./ and ../),

	ls -Al .?*
	
which on my system seems to work just fine.  (Forgot about single letter
files.)

--Matt
______________________________________________________________________________
Matt D. Robinson                                 "...if I only had a brain..."
Systems Programming Group, UC Riverside     -- The Scarecrow, The Wizard Of Oz
Internet : yakker@ucrmath.ucr.edu       UUCP : ..!ucsd!ucrmath!{yakker,source}

afsipmh@cid.aes.doe.CA (Patrick Hertel) (12/27/90)

In article <3658@jaytee.East.Sun.COM> msf@rotary.Central.Sun.COM (Mike Fischbein) writes:
>
>To list all the .* files except for . and .. why not use the standard
>ls option -A, viz:
>
>ls -Ad .*
>

   1) -A is not "standard" at least not on our IRIX machines

   2) -A lists . and .. on our suns despite what man purports
-- 
Pat Hertel                 Canadian Meteorological Centre
Analyst/Programmer         2121 N. Service Rd.        % rm God
phertel@cmc.aes.doe.ca     Dorval,Quebec              rm: God non-existent
Environment Canada         CANADA           H9P1J3

mcf@statware.UUCP (Mathieu Federspiel) (01/03/91)

You may use:

    ls -d .*

The -d tells ls to list a file as a directory, but not its
contents.

You may also:

    ls .[a-z]*

-- 
Mathieu Federspiel                  mcf%statware.uucp@cs.orst.edu
Statware                            orstcs!statware!mcf
260 SW Madison Avenue, Suite 109    503-753-5382
Corvallis  OR  97333  USA           503-758-4666 FAX

jms@romana.Tymnet.COM (Joe Smith) (01/05/91)

In article <1990Dec27.134022.14394@cid.aes.doe.CA> afsipmh@cid.aes.doe.CA (Patrick Hertel) writes:
>   1) -A is not "standard" at least not on our IRIX machines

It appears to be a UCB enhancement.

>   2) -A lists . and .. on our suns despite what man purports

Sounds like you have an unexpected alias for ls.

  (techserv/techserv) jms@tardis# ls
  ./                      .logout                 terminal.inventory
  ../                     bin/                    terminal.old-inv@
  .cshrc*                 cops/
  .login                  frames/
  (techserv/techserv) jms@tardis# /bin/ls
  .cshrc                  bin                     terminal.inventory
  .login                  cops                    terminal.old-inv
  .logout                 frames
  (techserv/techserv) jms@tardis# /bin/ls -A
  .cshrc                  bin                     terminal.inventory
  .login                  cops                    terminal.old-inv
  .logout                 frames
  (techserv/techserv) jms@tardis# /bin/ls -a
  .                       .logout                 terminal.inventory
  ..                      bin                     terminal.old-inv
  .cshrc                  cops
  .login                  frames
  (techserv/techserv) jms@tardis# /bin/ls -a -A
  .                       .logout                 terminal.inventory
  ..                      bin                     terminal.old-inv
  .cshrc                  cops
  .login                  frames
  (techserv/techserv) jms@tardis# alias ls
  ls -aF
  (techserv/techserv) jms@tardis#	# (Tested under SunOS-4.1)
  
The "-A" option is the default for root.
If "-a" and "-A" are both specified (possibly as a result of an alias),
the "-a" option wins.
  
-- 
Joe Smith (408)922-6220 | SMTP: jms@tardis.tymnet.com or jms@gemini.tymnet.com
BT Tymnet Tech Services | UUCP: ...!{ames,pyramid}!oliveb!tymix!tardis!jms
PO Box 49019, MS-C51    | BIX: smithjoe | CA license plate: "POPJ P," (PDP-10)
San Jose, CA 95161-9019 | humorous dislaimer: "My Amiga 3000 speaks for me."