* RE: Howto remove file by owner name
[not found] <<d4goqbFitf6U1@mid.individual.net>
@ 2015-08-30 22:02 ` Drew Adams
0 siblings, 0 replies; 2+ messages in thread
From: Drew Adams @ 2015-08-30 22:02 UTC (permalink / raw)
To: notbob, help-gnu-emacs
> IOW, when in dired, how does one flag files for deletion by owner
> name? I am unable to locate anything on this subject.
Two steps:
1. Mark those files, with `*' (instead of flagging them for deletion,
with `D').
2. Delete the files marked `*', using `D' (command `dired-do-delete').
To perform #1, you can use `M-(' or `* (' (command `dired-mark-sexp').
It prompts you for a sexp, which is then evaluated and used as a
predicate, testing file and dir entries in the buffer.
The sexp can refer to any of these variables (which are used only here):
`mode' [string] file permission bits, e.g. \"-rw-r--r--\"
`nlink' [integer] number of links to file
`size' [integer] file size in bytes
`uid' [string] owner
`gid' [string] group (If the gid is not displayed by `ls',
this will still be set (to the same as uid))
`time' [string] the time that `ls' displays, e.g. \"Feb 12 14:17\"
`name' [string] the name of the file
`sym' [string] if file is a symbolic link, the linked-to name,
else \"\"
`inode' [integer] the inode of the file (only for `ls -i' output)
`s' [integer] the size of the file for `ls -s' output
(ususally in blocks or, with `-k', in Kbytes)
Examples:
Mark zero-length files: `(equal 0 size)'
Mark files last modified on Feb 2: `(string-match \"Feb 2\" time)'
Mark uncompiled Emacs Lisp files (`.el' file without a `.elc' file):
First, Dired just the source files: `dired *.el'.
Then, use \\[dired-mark-sexp] with this sexp:
(not (file-exists-p (concat name \"c\")))
If you use Dired+ then use variable `blks' instead of `s' (which is
not a good name here).
In this case, you would do this:
M-( (equal uid "YOUR USER ID") RET
That is, you would type (equal uid "YOUR USER ID") at the prompt,
where YOUR USER ID is your user id (your UID).
Yes, you didn't find any info about this, because the doc doesn't
draw attention to it. There is even this longstanding comments in
the source code (`dired-x.el') asking whether anyone uses it:
;; Does anyone use this? - lrd 6/29/93.
;; Apparently people do use it. - lrd 12/22/97.
FWIW, I use it, and I added it as item `Mark If' to the `Mark' menu
for Dired+, and I clarified the prompt a bit, to mention the
predefined variables you can use in the sexp:
Mark if (vars: inode,blks,mode,nlink,uid,gid,size,time,name,sym):
^ permalink raw reply [flat|nested] 2+ messages in thread