[Top][All Lists]

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

Re: dired question

From: Brad Collins
Subject: Re: dired question
Date: Tue, 19 Oct 2004 05:49:25 +0700
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (windows-nt)

Stephen Dickey <address@hidden> writes:

> I would like to run a command on files marked in a dired buffer in the
> order in which they were marked.  Is there a built in way to do this?
> If not, I was thinking of advising dired-mark and
> dired-get-marked-files to do this.  Does this approach seem
> reasonable?

What about ! which runs the command dired-do-shell-command?

,----[! -- dired-do-shell-command]
| 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 C-u 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 `?'.

There was no mention about the order -- but they seem to be passed in
the order they are marked.  For example, I just marked three files
in dired :

* -rw-rw-rw-   1 deerpig  root        21495 05-29 00:27 2003.11.21
* -rw-rw-rw-   1 deerpig  root         6181 05-29 00:29 2003.12.18
* -rw-rw-rw-   1 deerpig  root          987 05-29 00:28 2003.12.21

And then did a word count.

   ! wc -w

and got this result in the minibuffer.

   3665 2003.11.21
   1003 2003.12.18
    143 2003.12.21

The order is the same as they were marked. Is that what you were
looking for?  dired-do-shell-command is very handy indeed, especially
for deleting non-empty directories, changing permissions etc.


Brad Collins <address@hidden>, Bangkok, Thailand

reply via email to

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