Date: Sat, 12 May 2001 13:14:02 -0500 From: Dan Nelson <dnelson@emsphone.com> To: Francois Kritzinger <ffkrz@iafrica.com> Cc: freeBSD Mailing List <questions@FreeBSD.ORG> Subject: Re: COPY, CUT, PASTE (FILES) Message-ID: <20010512131401.A26940@dan.emsphone.com> In-Reply-To: <3AFD167F.7480F4C6@iafrica.com>; from "Francois Kritzinger" on Sat May 12 12:54:55 GMT 2001 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
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010512131401.A26940>
