Date: Sun, 13 May 2001 00:55:45 +1000 From: Sue Blake <sue@welearn.com.au> To: Francois Kritzinger <ffkrz@iafrica.com> Cc: Dan Nelson <dnelson@emsphone.com>, freeBSD Mailing List <questions@FreeBSD.ORG> Subject: Re: COPY, CUT, PASTE (FILES) Message-ID: <20010513005544.I26110@welearn.com.au> In-Reply-To: <3AFD167F.7480F4C6@iafrica.com>; from ffkrz@iafrica.com on Sat, May 12, 2001 at 12:54:55PM %2B0200 References: <3AFCE758.63DE32E1@iafrica.com> <20010512023703.A24989@dan.emsphone.com> <3AFD167F.7480F4C6@iafrica.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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*- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010513005544.I26110>