> 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