unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* mask files and run command on them?
@ 2012-04-19  8:27 David Belohrad
  2012-04-19 16:38 ` Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: David Belohrad @ 2012-04-19  8:27 UTC (permalink / raw)
  To: help-gnu-emacs


Dear all,

could someone give me a piece of advice? I have lots of directories. I'd
like to mark them and then operate a command on each marked directory
separately. 

Typical usage:

dired
mark dirs using 'm'
-do- svn rm command on each of the selected directories



how I could handle this?

thanks
d.





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

* RE: mask files and run command on them?
  2012-04-19  8:27 mask files and run command on them? David Belohrad
@ 2012-04-19 16:38 ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2012-04-19 16:38 UTC (permalink / raw)
  To: 'David Belohrad', help-gnu-emacs

 
> could someone give me a piece of advice? I have lots of 
> directories. I'd like to mark them and then operate a
> command on each marked directory separately. 
> 
> Typical usage:
> dired
> mark dirs using 'm'
> -do- svn rm command on each of the selected directories
> 
> how I could handle this?

See the code in dired.el and dired-aux.el defining commands that do this.

See function `dired-get-marked-files' and perhaps macros `dired-map-over-marks'
and `dired-map-over-marks-check'.  See how they are used to define such
commands.  See command `dired-do-delete' as an example.

You can also see lots of examples defining such commands in dired+.el:
http://www.emacswiki.org/emacs/download/dired%2b.el




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

* Re: mask files and run command on them?
       [not found] <mailman.227.1334851234.751.help-gnu-emacs@gnu.org>
@ 2012-04-20 11:32 ` José A. Romero L.
  0 siblings, 0 replies; 3+ messages in thread
From: José A. Romero L. @ 2012-04-20 11:32 UTC (permalink / raw)
  To: help-gnu-emacs; +Cc: help-gnu-emacs

W dniu czwartek, 19 kwietnia 2012 10:27:42 UTC+2 użytkownik David Belohrad napisał:
(...)
> dired
> mark dirs using 'm'
> -do- svn rm command on each of the selected directories
> 
> how I could handle this?
(...)

Have a look at `dired-do-shell-command' in dired-aux.el:

    dired-do-shell-command is an interactive compiled Lisp function in
    `dired-aux.el'.
    
    (dired-do-shell-command COMMAND &optional ARG FILE-LIST)
    
    Run a shell command COMMAND on the marked files.
    If no files are marked or a specific numeric prefix arg is given,
    the next ARG files are used.  Just M-x universal-argument means the current file.
    The prompt mentions the file(s) or the marker, as appropriate.
    
    If there is a `*' in COMMAND, surrounded by whitespace, this runs
    COMMAND just once with the entire file list substituted there.
    
    If there is no `*', but there is a `?' in COMMAND, surrounded by
    whitespace, this runs COMMAND on each file individually with the
    file name substituted for `?'.
    
    Otherwise, this runs COMMAND on each file individually with the
    file name added at the end of COMMAND (separated by a space).

You may need to add a (require 'dired-aux) to you .emacs file to have
it available. It's usuable mapped to '!'.

Cheers,
--
José A. Romero L.
escherdragon at gmail
"We who cut mere stones must always be envisioning cathedrals."
(Quarry worker's creed)



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

end of thread, other threads:[~2012-04-20 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-19  8:27 mask files and run command on them? David Belohrad
2012-04-19 16:38 ` Drew Adams
     [not found] <mailman.227.1334851234.751.help-gnu-emacs@gnu.org>
2012-04-20 11:32 ` José A. Romero L.

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).