home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!uwm.edu!cs.utexas.edu!sun-barr!sh.wide!wnoc-tyo-news!news.u-tokyo.ac.jp!enterprise!ksakai
- From: ksakai@mtl.t.u-tokyo.ac.jp (Kiyotaka Sakai)
- Newsgroups: comp.unix.shell
- Subject: Re: cp
- Message-ID: <KSAKAI.93Jan2184016@noah.mtl.t.u-tokyo.ac.jp>
- Date: 2 Jan 93 09:40:16 GMT
- References: <1992Dec31.221946.22162@netcom.com>
- Sender: news@enterprise.mtl.t.u-tokyo.ac.jp
- Organization: University of Tokyo, Tokyo, Japan.
- Lines: 18
- Nntp-Posting-Host: noah.mtl.t.u-tokyo.ac.jp
- In-reply-to: kasajian@netcom.com's message of 1 Jan 1993 07:19:46 JST
-
- In article <1992Dec31.221946.22162@netcom.com> kasajian@netcom.com (Kenneth Kasajian) writes:
-
- >How do I copy all the files in the current directory into a subdirectory
- >name 'sub'. I do :
- >cp * sub/
- >but then it tries to copy all the subdirectories as well. I've tried
- >doing :
- >cp `find . -type f -print` sub/
- >but find finds all files below the current, not just the current directory.
- >I guess I can use ls, but how do I get ls to only display the files only
- >and not directories?
-
- Try foreach.
-
- example:
- csh% foreach f ( * )
- ? if ( -f $f ) mv $f sub
- ? end
-