home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!pacsoft!mike
- From: mike@pacsoft.com (Mike Stefanik)
- Newsgroups: comp.unix.shell
- Subject: Re: need a bit of help in
- Message-ID: <1482@pacsoft.com>
- Date: 2 Jan 93 10:52:39 GMT
- References: <1993Jan1.195022.23031@mnemosyne.cs.du.edu>
- Organization: Pacific Software Group, Riverside, CA
- Lines: 29
-
- In an article, rduta@nyx.cs.du.edu (Radu) writes:
- >1) I want a method of copying whole directories. I'm used to the mac where
- >you can just drag folders form one dir to another and it moves it or
- >copies it. I want something similar for unix. The thing is that I
- >Haven't the slightest idea how to start.
-
- If you want to copy a directory (as well as all of the subdirectories
- underneath it) you can use the find(1) and cpio(1) commands:
-
- ( cd /some/directory; find . -print ) | cpio -pdum /somewhere/new
-
- If you want to rename or move directories around, try mv(1) or mvdir(1)
-
- >2) I was wandering what is the easiest way to do a recursive grep, where
- >it searches all the files in all dirs. I was thinking something along
- >the lines of "grep -R string *" but the "-R" flag is not an option.
-
- Again, use the find(1) command in conjunction with xargs(1) and grep(1),
- such as:
-
- find . -type f -print | xargs -e grep "foo"
-
- The "-type f" option tells find(1) to only return regular files (not
- directories, character or block special device files, etc.) and xargs(1)
- collects the filenames through the pipe and gives them to grep(1).
-
- --
- Mike Stefanik mike@pacsoft.com ...!uunet!pacsoft!mike (909) 681-2623
- Pacific Software Group, Riverside, CA
-