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

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

Re: delete-file using wildcard


From: ishi soichi
Subject: Re: delete-file using wildcard
Date: Sun, 30 Oct 2011 05:30:59 +0900

Thanks for many solutions.
I appreciate it!

soichi

2011/10/29 Drew Adams <drew.adams@oracle.com>
> I would like to delete files in a directory.
> When doing so with Linux command, we usually do, rm *
> at that directory.
> the wildcard command does not seem work similarly in Emacs Lisp.
> (delete-file (subseq (file-expand-wildcards "~/Desktop/*") -1))
> doesn't work.  Could anyone help me out?

Others have provided some solutions.  To do it interactively, Dired is your
friend, as Jambunathan suggested.

Another interactive solution is `icicle-delete-file'.  It's a multi-command
version of `delete-file', which means that you can act on (delete, in this case)
any number of files and directories with the same command invocation.

For your example, just do this: M-x icicle-delete-file TAB C-!

You can type a pattern to match, before hitting TAB (or S-TAB, if the pattern is
a regexp).  The key `C-!' means act on *all* matching candidates.  Whatever file
names currently match your minibuffer input (they are shown in *Completions*),
those files are deleted.  Or use `C-mouse-2' or `C-RET' to act on only one
candidate at a time.

Change your input (pattern) to act on different files.  You can also change to
another directory, using `C-c C-d'.  All during the same command invocation.
Use C-g to end the command (or RET to act on one final candidate).

http://www.emacswiki.org/emacs/Icicles_-_Multi-Commands#toc3



reply via email to

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