home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / unix / shell / 5224 < prev    next >
Encoding:
Internet Message Format  |  1993-01-02  |  1.1 KB

  1. 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
  2. From: ksakai@mtl.t.u-tokyo.ac.jp (Kiyotaka Sakai)
  3. Newsgroups: comp.unix.shell
  4. Subject: Re: cp
  5. Message-ID: <KSAKAI.93Jan2184016@noah.mtl.t.u-tokyo.ac.jp>
  6. Date: 2 Jan 93 09:40:16 GMT
  7. References: <1992Dec31.221946.22162@netcom.com>
  8. Sender: news@enterprise.mtl.t.u-tokyo.ac.jp
  9. Organization: University of Tokyo, Tokyo, Japan.
  10. Lines: 18
  11. Nntp-Posting-Host: noah.mtl.t.u-tokyo.ac.jp
  12. In-reply-to: kasajian@netcom.com's message of 1 Jan 1993 07:19:46 JST
  13.  
  14. In article <1992Dec31.221946.22162@netcom.com> kasajian@netcom.com (Kenneth Kasajian) writes:
  15.  
  16.  >How do I copy all the files in the current directory into a subdirectory
  17.  >name 'sub'.  I do :
  18.  >cp * sub/
  19.  >but then it tries to copy all the subdirectories as well.  I've tried
  20.  >doing :
  21.  >cp `find . -type f -print` sub/
  22.  >but find finds all files below the current, not just the current directory.
  23.  >I guess I can use ls, but how do I get ls to only display the files only
  24.  >and not directories?
  25.  
  26. Try foreach.
  27.  
  28. example:
  29. csh% foreach f ( * )
  30. ? if ( -f $f ) mv $f sub
  31. ? end
  32.