unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* dired copy marked files in xterm
@ 2008-02-24 19:26 Fabian Braennstroem
  2008-02-24 21:05 ` Thierry Volpiatto
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2008-02-24 19:26 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

    I would like to use the system 'cp' function in an xterm
    to copy marked files in dired.
    Right now, this small function works with the current
    file:

(defun tacopybackground(var1)
    "Copy"
  (interactive)
       (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-filename)" " (dired-dwim-target-directory) " &'"))
       )

    but obviously it needs some kind of loop or different
    approach for marked files!?:

       (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-marked-files)" " (dired-dwim-target-directory) " &'"))

    Does anyone have an idea or any suggestion? At the end I
    would actually use a similar command to transfer several
    large (up to 2-3GB) files to an remote machine using
    scp. Tramp is unfortunately to slow...

Greetings!
 Fabian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-24 19:26 dired copy marked files in xterm Fabian Braennstroem
@ 2008-02-24 21:05 ` Thierry Volpiatto
  2008-02-24 21:11 ` David Hansen
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Thierry Volpiatto @ 2008-02-24 21:05 UTC (permalink / raw)
  To: f.braennstroem; +Cc: help-gnu-emacs

Fabian Braennstroem <f.braennstroem@gmx.de> writes:

> Hi,
>
>     I would like to use the system 'cp' function in an xterm
>     to copy marked files in dired.
>     Right now, this small function works with the current
>     file:
>
> (defun tacopybackground(var1)
>     "Copy"
>   (interactive)
>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-filename)" " (dired-dwim-target-directory) " &'"))
>        )
>
>     but obviously it needs some kind of loop or different
>     approach for marked files!?:
>
>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-marked-files)" " (dired-dwim-target-directory) " &'"))
>
>     Does anyone have an idea or any suggestion? At the end I
>     would actually use a similar command to transfer several
>     large (up to 2-3GB) files to an remote machine using
>     scp. Tramp is unfortunately to slow...
>
> Greetings!
>  Fabian
>

You have to format "(dired-get-marked-files)" and
"(dired-dwim-target-directory)"??==> is it a function ?

But what wrong with "C" in dired ?
Mark your files and hit C ==> the path_where_you_want_to_copy_your_file RET

For copying big files to remote from emacs use sshfs
It's as fast as on your local system.

-- 
A + Thierry
Pub key: http://pgp.mit.edu




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-24 19:26 dired copy marked files in xterm Fabian Braennstroem
  2008-02-24 21:05 ` Thierry Volpiatto
@ 2008-02-24 21:11 ` David Hansen
       [not found] ` <mailman.7870.1203888211.18990.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: David Hansen @ 2008-02-24 21:11 UTC (permalink / raw)
  To: help-gnu-emacs

On Sun, 24 Feb 2008 20:26:22 +0100 Fabian Braennstroem wrote:

>     Does anyone have an idea or any suggestion? At the end I
>     would actually use a similar command to transfer several
>     large (up to 2-3GB) files to an remote machine using
>     scp. Tramp is unfortunately to slow...

Mark the files in dired and then ! scp * host:/target/dir/ & RET

Emacs substitutes the `*' with the marked files and the `&' tells emacs
to run the shell command async.

David





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
       [not found] ` <mailman.7870.1203888211.18990.help-gnu-emacs@gnu.org>
@ 2008-02-25 19:10   ` Fabian Braennstroem
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2008-02-25 19:10 UTC (permalink / raw)
  To: help-gnu-emacs

Hi David,

* David Hansen <david.hansen@gmx.net> wrote:
> On Sun, 24 Feb 2008 20:26:22 +0100 Fabian Braennstroem wrote:
>
>>     Does anyone have an idea or any suggestion? At the end I
>>     would actually use a similar command to transfer several
>>     large (up to 2-3GB) files to an remote machine using
>>     scp. Tramp is unfortunately to slow...
>
> Mark the files in dired and then ! scp * host:/target/dir/ & RET
>
> Emacs substitutes the `*' with the marked files and the `&' tells emacs
> to run the shell command async.

Thanks! This works, but  the disadvantage with this approach is that I am not
able to use the dwim-variable to copy to the other open
dired buffer!? Or do you have an idea, how to use it and how to bind the
dired-shell-command  to a key
binding in dired? Would be nice!


Greetings!
 Fabian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
       [not found] ` <mailman.7867.1203886432.18990.help-gnu-emacs@gnu.org>
@ 2008-02-25 19:15   ` Fabian Braennstroem
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2008-02-25 19:15 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Thierry,
* Thierry Volpiatto <thierry.volpiatto@gmail.com> wrote:
> Fabian Braennstroem <f.braennstroem@gmx.de> writes:
>
>> Hi,
>>
>>     I would like to use the system 'cp' function in an xterm
>>     to copy marked files in dired.
>>     Right now, this small function works with the current
>>     file:
>>
>> (defun tacopybackground(var1)
>>     "Copy"
>>   (interactive)
>>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-filename)" " (dired-dwim-target-directory) " &'"))
>>        )
>>
>>     but obviously it needs some kind of loop or different
>>     approach for marked files!?:
>>
>>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-marked-files)" " (dired-dwim-target-directory) " &'"))
>>
>>     Does anyone have an idea or any suggestion? At the end I
>>     would actually use a similar command to transfer several
>>     large (up to 2-3GB) files to an remote machine using
>>     scp. Tramp is unfortunately to slow...
>>
>> Greetings!
>>  Fabian
>>
>
> You have to format "(dired-get-marked-files)" and
> "(dired-dwim-target-directory)"??==> is it a function ?

I don't understand your question.

>
> But what wrong with "C" in dired ?
> Mark your files and hit C ==> the path_where_you_want_to_copy_your_file RET

It is much slower, than the system's copy.

>
> For copying big files to remote from emacs use sshfs
> It's as fast as on your local system.

Thanks for your sshfs hint, but I am not sure yet, if it
works with our setup.

Greetings!
 Fabian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-24 19:26 dired copy marked files in xterm Fabian Braennstroem
                   ` (3 preceding siblings ...)
       [not found] ` <mailman.7867.1203886432.18990.help-gnu-emacs@gnu.org>
@ 2008-02-26 10:22 ` Piet van Oostrum
  2008-02-26 20:21   ` Fabian Braennstroem
  4 siblings, 1 reply; 9+ messages in thread
From: Piet van Oostrum @ 2008-02-26 10:22 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Fabian Braennstroem <f.braennstroem@gmx.de> (FB) wrote:

>FB> Hi,

>FB>     I would like to use the system 'cp' function in an xterm
>FB>     to copy marked files in dired.
>FB>     Right now, this small function works with the current
>FB>     file:

>FB> (defun tacopybackground(var1)
>FB>     "Copy"
>FB>   (interactive)
>FB>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-filename)" " (dired-dwim-target-directory) " &'"))
>FB>        )

>FB>     but obviously it needs some kind of loop or different
>FB>     approach for marked files!?:

>FB>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-marked-files)" " (dired-dwim-target-directory) " &'"))

Does this what you want?

       (call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'cp -R " (dired-get-marked-files) nil) " " (dired-dwim-target-directory) " &'"))

By the way, you may have to do some additional shell-quoting on the target
directory. dired-shell-stuff-t does it on the file list. 
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-26 10:22 ` Piet van Oostrum
@ 2008-02-26 20:21   ` Fabian Braennstroem
  2008-02-27 10:49     ` Piet van Oostrum
  0 siblings, 1 reply; 9+ messages in thread
From: Fabian Braennstroem @ 2008-02-26 20:21 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Piet,

* Piet van Oostrum <piet@cs.uu.nl> wrote:
>>>>>> Fabian Braennstroem <f.braennstroem@gmx.de> (FB) wrote:
>
>>FB> Hi,
>
>>FB>     I would like to use the system 'cp' function in an xterm
>>FB>     to copy marked files in dired.
>>FB>     Right now, this small function works with the current
>>FB>     file:
>
>>FB> (defun tacopybackground(var1)
>>FB>     "Copy"
>>FB>   (interactive)
>>FB>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-filename)" " (dired-dwim-target-directory) " &'"))
>>FB>        )
>
>>FB>     but obviously it needs some kind of loop or different
>>FB>     approach for marked files!?:
>
>>FB>        (call-process-shell-command (concat "xterm -e 'cp -R "(dired-get-marked-files)" " (dired-dwim-target-directory) " &'"))
>
> Does this what you want?
>
>        (call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'cp -R " (dired-get-marked-files) nil) " " (dired-dwim-target-directory) " &'"))
>
> By the way, you may have to do some additional shell-quoting on the target
> directory. dired-shell-stuff-t does it on the file list. 

Thanks for your help! This works good with a small adjustment.
A different problem is to use 'scp' or in my case something similar, in my case 'hput'. It copies the file to the cluster with a syntax like:

hput -R cluster_directory  files_to_copy

Using: 'hput -R /some_remote_directory *' as a shell-command works, but a small adjustment of your line:

(defun hputbackground()
    "Put"
    (interactive)
    (message (dired-dwim-target-directory))
    (message (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)))
       (call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'hput -R " (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)) nil) " " (dired-get-marked-files) " '&"))
       ;(call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'cp -R " (dired-get-marked-files) nil) " " (dired-dwim-target-directory) " '&")) 
       )

gives me this error:

/rsh:ppb37@10.134.130.2:/home/ppb37/
/home/ppb37/
shell-quote-argument: Wrong type argument: stringp, 47

Do you have an idea!?


Greetings!
 Fabian


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-26 20:21   ` Fabian Braennstroem
@ 2008-02-27 10:49     ` Piet van Oostrum
  2008-03-03 19:44       ` Fabian Braennstroem
  0 siblings, 1 reply; 9+ messages in thread
From: Piet van Oostrum @ 2008-02-27 10:49 UTC (permalink / raw)
  To: help-gnu-emacs

>>>>> Fabian Braennstroem <f.braennstroem@gmx.de> (FB) wrote:

>FB> Thanks for your help! This works good with a small adjustment.
>FB> A different problem is to use 'scp' or in my case something similar, in my case 'hput'. It copies the file to the cluster with a syntax like:

>FB> hput -R cluster_directory  files_to_copy

>FB> Using: 'hput -R /some_remote_directory *' as a shell-command works, but a small adjustment of your line:

>FB> (defun hputbackground()
>FB>     "Put"
>FB>     (interactive)
>FB>     (message (dired-dwim-target-directory))
>FB>     (message (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)))
>FB>        (call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'hput -R " (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)) nil) " " (dired-get-marked-files) " '&"))
>FB>        ;(call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'cp -R " (dired-get-marked-files) nil) " " (dired-dwim-target-directory) " '&")) 
>FB>        )

>FB> gives me this error:

>FB> /rsh:ppb37@10.134.130.2:/home/ppb37/
>FB> /home/ppb37/
>FB> shell-quote-argument: Wrong type argument: stringp, 47

>FB> Do you have an idea!?

Yes, (dired-get-marked-files) should be used as the second argument of
dired-shell-stuff-it. 

So I guess you should use something like:

(concat (dired-shell-stuff-it (concat "xterm -e 'hput -R "
(replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" ""
(dired-dwim-target-directory))) (dired-get-marked-files) nil) " '&")

(defun dired-shell-stuff-it (command file-list on-each &optional raw-arg)
;; "Make up a shell command line from COMMAND and FILE-LIST.
;; If ON-EACH is t, COMMAND should be applied to each file, else
;; simply concat all files and apply COMMAND to this.
;; FILE-LIST's elements will be quoted for the shell."
(raw-arg isn't used)
-- 
Piet van Oostrum <piet@cs.uu.nl>
URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4]
Private email: piet@vanoostrum.org


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: dired copy marked files in xterm
  2008-02-27 10:49     ` Piet van Oostrum
@ 2008-03-03 19:44       ` Fabian Braennstroem
  0 siblings, 0 replies; 9+ messages in thread
From: Fabian Braennstroem @ 2008-03-03 19:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hi Piet,

* Piet van Oostrum <piet@cs.uu.nl> wrote:
>>>>>> Fabian Braennstroem <f.braennstroem@gmx.de> (FB) wrote:
>
>>FB> Thanks for your help! This works good with a small adjustment.
>>FB> A different problem is to use 'scp' or in my case something similar, in my case 'hput'. It copies the file to the cluster with a syntax like:
>
>>FB> hput -R cluster_directory  files_to_copy
>
>>FB> Using: 'hput -R /some_remote_directory *' as a shell-command works, but a small adjustment of your line:
>
>>FB> (defun hputbackground()
>>FB>     "Put"
>>FB>     (interactive)
>>FB>     (message (dired-dwim-target-directory))
>>FB>     (message (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)))
>>FB>        (call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'hput -R " (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" "" (dired-dwim-target-directory)) nil) " " (dired-get-marked-files) " '&"))
>>FB>        ;(call-process-shell-command (concat (dired-shell-stuff-it "xterm -e 'cp -R " (dired-get-marked-files) nil) " " (dired-dwim-target-directory) " '&")) 
>>FB>        )
>
>>FB> gives me this error:
>
>>FB> /rsh:ppb37@10.134.130.2:/home/ppb37/
>>FB> /home/ppb37/
>>FB> shell-quote-argument: Wrong type argument: stringp, 47
>
>>FB> Do you have an idea!?
>
> Yes, (dired-get-marked-files) should be used as the second argument of
> dired-shell-stuff-it. 
>
> So I guess you should use something like:
>
> (concat (dired-shell-stuff-it (concat "xterm -e 'hput -R "
> (replace-regexp-in-string "/rsh:ppb37@10.134.130.2:" ""
> (dired-dwim-target-directory))) (dired-get-marked-files) nil) " '&")
>
> (defun dired-shell-stuff-it (command file-list on-each &optional raw-arg)
> ;; "Make up a shell command line from COMMAND and FILE-LIST.
> ;; If ON-EACH is t, COMMAND should be applied to each file, else
> ;; simply concat all files and apply COMMAND to this.
> ;; FILE-LIST's elements will be quoted for the shell."
> (raw-arg isn't used)

Thanks for your help! It works... :-)

Greetings!
 Fabian


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2008-03-03 19:44 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-24 19:26 dired copy marked files in xterm Fabian Braennstroem
2008-02-24 21:05 ` Thierry Volpiatto
2008-02-24 21:11 ` David Hansen
     [not found] ` <mailman.7870.1203888211.18990.help-gnu-emacs@gnu.org>
2008-02-25 19:10   ` Fabian Braennstroem
     [not found] ` <mailman.7867.1203886432.18990.help-gnu-emacs@gnu.org>
2008-02-25 19:15   ` Fabian Braennstroem
2008-02-26 10:22 ` Piet van Oostrum
2008-02-26 20:21   ` Fabian Braennstroem
2008-02-27 10:49     ` Piet van Oostrum
2008-03-03 19:44       ` Fabian Braennstroem

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).