From owner-freebsd-questions Sat May 12 11:14:11 2001 Delivered-To: freebsd-questions@freebsd.org Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by hub.freebsd.org (Postfix) with ESMTP id 8CBA137B424 for ; Sat, 12 May 2001 11:14:08 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.11.3/8.11.3) id f4CIE2r08980; Sat, 12 May 2001 13:14:02 -0500 (CDT) (envelope-from dan) Date: Sat, 12 May 2001 13:14:02 -0500 From: Dan Nelson To: Francois Kritzinger Cc: freeBSD Mailing List Subject: Re: COPY, CUT, PASTE (FILES) Message-ID: <20010512131401.A26940@dan.emsphone.com> References: <3AFCE758.63DE32E1@iafrica.com> <20010512023703.A24989@dan.emsphone.com> <3AFD167F.7480F4C6@iafrica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.3.17i In-Reply-To: <3AFD167F.7480F4C6@iafrica.com>; from "Francois Kritzinger" on Sat May 12 12:54:55 GMT 2001 X-OS: FreeBSD 5.0-CURRENT Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG In the last episode (May 12), Francois Kritzinger said: > 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. You could always install the misc/mc port, which is an excellent full-screen text-mode file manager; I use it quite a bit. Or, if all you really need to do is remember the full pathnames of a group of files for later use, you can try something like this zsh shell function: remember () { remember=() ; local i ; for i in $@ ; do files=($files `realpath $i`) ; done } Then you can do things like ~$ cd /tmp /tmp$ ls ./ makeZKfzhNjCmv uthread.dump.882.0 ../ mysql.sock= uthread.dump.882.1 /tmp$ remember uth* /tmp$ echo $files /tmp/uthread.dump.882.0 /tmp/uthread.dump.882.1 /tmp$ cd ~/logs ~/logs$ ls ./ ../ ~/logs$ cp $files . ~/logs$ ls ./ uthread.dump.882.0 ../ uthread.dump.882.1 ~/logs$ The remember shell function simply takes its commandline arguments, calls "realpath" on each one to create an absolute path, and stores the results in a shell array $files. Since the array consists of absolute paths, you can cd wherever you want, and be confident that $files always to refer to the right files. So instead of "cut/copy" and "paste" later, you use "remember" and "mv/cp/vi/lp/rm/whatever" later. -- Dan Nelson dnelson@emsphone.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message