help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: dired copy marked files in xterm


From: Fabian Braennstroem
Subject: Re: dired copy marked files in xterm
Date: Tue, 26 Feb 2008 21:21:33 +0100
User-agent: slrn/0.9.8.1pl1 (Debian)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]