From owner-freebsd-questions Sat May 12 10:51: 2 2001 Delivered-To: freebsd-questions@freebsd.org Received: from smtp06.iafrica.com (smtp06.iafrica.com [196.2.51.5]) by hub.freebsd.org (Postfix) with ESMTP id 897FD37B424 for ; Sat, 12 May 2001 10:50:56 -0700 (PDT) (envelope-from ffkrz@iafrica.com) Received: from iafrica.com ([196.30.180.30]) by smtp06.iafrica.com (Sun Internet Mail Server sims.3.5.2000.03.23.18.03.p10) with ESMTP id <0GD800BJ2HJAZJ@smtp06.iafrica.com> for questions@FreeBSD.ORG; Sat, 12 May 2001 19:50:00 +0200 (SAT) Date: Sat, 12 May 2001 19:51:02 +0200 From: Francois Kritzinger Subject: Re: COPY, CUT, PASTE (FILES) To: Sue Blake Cc: freeBSD Mailing List Message-id: <3AFD7806.842060EA@iafrica.com> MIME-version: 1.0 X-Mailer: Mozilla 4.76 [en] (X11; U; FreeBSD 4.2-RELEASE i386) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en References: <3AFCE758.63DE32E1@iafrica.com> <20010512023703.A24989@dan.emsphone.com> <3AFD167F.7480F4C6@iafrica.com> <20010513005544.I26110@welearn.com.au> Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Sue Blake wrote: > On Sat, May 12, 2001 at 12:54:55PM +0200, Francois Kritzinger wrote: > > Dan Nelson wrote: > > > > > In the last episode (May 12), Francois Kritzinger said: > > > > Is there a way to copy, cut and then paste files from the shell? > > > > E.g. "cut *.txt" and then "cd other_directory" and then "paste"... > > > > > > You mean besides the all-in-one command "cp"? > > > > > > cp *.txt other_directory > > > > > > -- > > > Dan Nelson > > > dnelson@emsphone.com > > > > No, for that you need to know exactly where you want to put the files. > > > > In this case you know that you want to copy or move the files somewhere, > > you just dont know exactly where yet. Like in a file manager - when you > > right click a file, you can select "copy" or "cut" (the files' paths get > > written to a "clipboard") and then browse around till you find the dir > > you want to put the files. Then when you find the dir in which you want > > to put the files, you simply type (for example) "paste", and the files > > get copied or moved into the current dir. > > > > Like a file manager. > > In your original request you said from the shell. If you need to > navigate around a bit to find the destination, here's one way: > > $ ls # read the file choices > $ # mv first.file secondfile.zip letter*.txt # # marks it as a comment > $ ls -F /wherever # dir somewhere in here? > $ ls -F /wherever/rightplace # yes, this directory > $ # mv first.file secondfile.zip letter*.txt # up-arrows, then edit... > $ mv first.file secondfile.zip letter*.txt /wherever/rightplace > > For the final command, use the up arrow until you get to your earlier > comment from the command-history. Then type the found destination path > at the end (where you want to copy the files to), then jump to the > beginning of the command line (^A might work) and delete the # sign. > > It's much easier than I made it look, so long as you resist any > temptation to change directory. And of course you can mv or cp. > > If you regard that comment line as the "cut", it's a nice safe cut > because the files don't leave their first directory until commanded to > move to their new directory. So to abort, just don't run the last command. > > Let's say you're in the destination directory and looking for the files: > > $ ls /some/path # then use up-arrow > $ ls /some/path/directory # look for file names > $ cp /some/path/directory/*.txt . # notice dot for current dir > $ cp /some/path/directory/*.gz . # edit and repeat for others > > Because of the command history, this involves little typing and it > is usually quicker than fiddling with the mouse, menus, etc. > > -- > > Regards, > -*Sue*- > Hi I wanted to know if there was a SINGLE command/utility in unix to do this. I.e. a program like cp or mv which does it all in one go. I'm sorry I guess I should have made that clearer. Thanks for your input though :), and sorry for making you type all that out :( Cheerio To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message