Delete marked files from dired

classic Classic list List threaded Threaded
33 messages Options
12
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Delete marked files from dired

notbob
I've gotta lotta files to delete before rsyncing to a thumb drive.  I
know how to mark all files in a dir (* s) when in dired mode, but do not know how to
delete all those marked files.  Anybody?  ;)

nb
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

John Mastro
notbob <[hidden email]> wrote:
> I've gotta lotta files to delete before rsyncing to a thumb drive.  I
> know how to mark all files in a dir (* s) when in dired mode, but do not know how to
> delete all those marked files.  Anybody?  ;)

Press D, for `dired-do-delete'

        John

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by notbob
notbob wrote:

> I've gotta lotta files to delete before
> rsyncing to a thumb drive. I know how to mark
> all files in a dir (* s) when in dired mode,
> but do not know how to delete all those
> marked files. Anybody? ;)

D for `dired-do-delete', right?

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Harry Putnam
In reply to this post by notbob
notbob <[hidden email]> writes:

> I've gotta lotta files to delete before rsyncing to a thumb drive.  I
> know how to mark all files in a dir (* s) when in dired mode, but do not know how to
> delete all those marked files.  Anybody?  ;)

Not sure how you are marking them, ... but if you use the d key and
them the x key you should get prompted if you want to delete the file.




Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Harry Putnam
Harry Putnam <[hidden email]> writes:

> notbob <[hidden email]> writes:
>
>> I've gotta lotta files to delete before rsyncing to a thumb drive.  I
>> know how to mark all files in a dir (* s) when in dired mode, but do not know how to
>> delete all those marked files.  Anybody?  ;)
>
> Not sure how you are marking them, ... but if you use the d key and
> them the x key you should get prompted if you want to delete the file.

Sorry didn't see the other posts before posting above msg


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by Harry Putnam
Harry Putnam wrote:

>> I've gotta lotta files to delete before
>> rsyncing to a thumb drive. I know how to
>> mark all files in a dir (* s) when in dired
>> mode, but do not know how to delete all
>> those marked files. Anybody? ;)
>
> Not sure how you are marking them, ... but if
> you use the d key and them the x key you
> should get prompted if you want to delete
> the file.

He is marking them with keys * s which is
`dired-mark-subdir-files'. x, or
`dired-do-flagged-delete' doesn't work then (it
does for d, `dired-flag-file-deletion', as you
mention) but perhaps the OP was unaware of that
method as well so why not.

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by notbob
notbob wrote:

> I've gotta lotta files to delete before
> rsyncing to a thumb drive. I know how to mark
> all files in a dir (* s) when in dired mode,
> but do not know how to delete all those
> marked files. Anybody? ;)

By the way, you can find answer to questions
such as this one with Emacs' `apropos' command.
Do

    M-x apropos RET dired delete RET

and see what you find. For this particular
question `apropos-command' is even better
because what you want to do is do something.

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Yuri Khan-2
In reply to this post by Emanuel Berg-4
On Fri, Jun 2, 2017 at 7:29 AM, Emanuel Berg <[hidden email]> wrote:

> He is marking them with keys * s which is
> `dired-mark-subdir-files'. x, or
> `dired-do-flagged-delete' doesn't work then (it
> does for d, `dired-flag-file-deletion', as you
> mention) but perhaps the OP was unaware of that
> method as well so why not.

Does somebody remember the story of different marks?

I mean, Dired has D for flagging for deletion, * for marking for most
other operations, and a command to change one mark to another. Ibuffer
has D for killing and > for other operations.

Most other file managers have just one kind of mark and it works the
same way for copying, moving, and deleting.

I wonder how and why that feature evolved?

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Marcin Borkowski-3
In reply to this post by notbob

On 2017-06-02, at 00:10, notbob <[hidden email]> wrote:

> I've gotta lotta files to delete before rsyncing to a thumb drive.  I
> know how to mark all files in a dir (* s) when in dired mode, but do not know how to
> delete all those marked files.  Anybody?  ;)

I didn't know about dired-do-delete, but here's another way (more
complicated, but potentially useful for other things).  You probably
know that you can mark files with `D' (for delete) or `*' (for other
things).  You might not know that you can have other marks
(one-character only, I presume), and change them with
`dired-change-marks' (`* c').  So, after marking with `m' (which uses
`*' as the mark), you can type

* c * D x

Hth,

--
Marcin Borkowski

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Marco Wahl-2
In reply to this post by notbob
notbob <[hidden email]> writes:

> I've gotta lotta files to delete before rsyncing to a thumb drive.  I
> know how to mark all files in a dir (* s) when in dired mode, but do not know how to
> delete all those marked files.  Anybody?  ;)

*c*Dx

This is change the * marks to D marks (D for deletion).  Then execute
(x).


Ciao
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

RE: Delete marked files from dired

Drew Adams
In reply to this post by Yuri Khan-2
> Does somebody remember the story of different marks?
>
> I mean, Dired has D for flagging for deletion, * for marking for most
> other operations, and a command to change one mark to another. Ibuffer
> has D for killing and > for other operations.
>
> Most other file managers have just one kind of mark and
> it works the same way for copying, moving, and deleting.
>
> I wonder how and why that feature evolved?

It is a very useful feature.  You can easily have any
number of different marks, representing _different sets_
of files, and then act on any given set in various ways.

Dired keys that act on marked files typically act on the
files marked `*'.  (Those marked `D' are usually called
"flagged", not just "marked", and only one key, `D', acts
directly on them.)

Changing files marked with `*' to another mark keeps
them marked (keeps that set defined) but removes them
from being acted on (by commands that act on `*'-marked
files, which is the typical case).

Changing another mark back to `*' lets you then act
on its files.  If there are already some other files
marked `*' when you do that then you have effectively
joined those two sets (union).

You get the idea.  It's really pretty simple and quite
visible - you can see the various labeled sets.

It's a bit like using tags in Bookmark+, but only one
mark at a time applies to a given file.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

notbob
In reply to this post by Marco Wahl-2
On 2017-06-02, Marco Wahl <[hidden email]> wrote:

> *c*Dx
>
> This is change the * marks to D marks (D for deletion).  Then execute
> (x).

Works like a champ!  Thank you, so much, Marco.  ;)

nb
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Thien-Thi Nguyen-3
In reply to this post by Yuri Khan-2

() Yuri Khan <[hidden email]>
() Fri, 2 Jun 2017 11:55:15 +0700

   I wonder how and why that feature evolved?

IIRC (corrections welcome) way beck when, there was only the ‘d’
(key) producing ‘D’ in the left margin.  The other keys, letters
and symbols were a generalization that avoided subsuming ‘d’/‘D’
because such force is uncouth to long-time users' muscle-memory.

--
Thien-Thi Nguyen -----------------------------------------------
 (defun responsep (query)
   (pcase (context query)
     (`(technical ,ml) (correctp ml))
     ...))                              748E A0E8 1CB8 A748 9BFA
--------------------------------------- 6CE4 6703 2224 4C80 7502


signature.asc (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by Yuri Khan-2
Yuri Khan <[hidden email]> writes:

>> He is marking them with keys * s which is
>> `dired-mark-subdir-files'. x, or
>> `dired-do-flagged-delete' doesn't work then (it
>> does for d, `dired-flag-file-deletion', as you
>> mention) but perhaps the OP was unaware of that
>> method as well so why not.
>
> Does somebody remember the story of different marks?
>
> I mean, Dired has D for flagging for deletion, * for
> marking for most other operations, and a command to
> change one mark to another. Ibuffer has D for
> killing and > for other operations.

I don't remember because I never knew, but there can
be tons of application. For example, one target file
and one source; then hit a key to invoke source on
target (e.g., move a file into a dir or feed indata
from a text file as argument to an executable).

In this case, I suspect it is to separate deletion
from everything else, as a convenience/security
mechanism. Which makes sense!

> Most other file managers have just one kind of mark
> and it works the same way for copying, moving,
> and deleting.

One counterexample is Gnus, tho not a generic file
manager, in practice is/could be just that with
respect to mail/articles/posts, which are/can be
stored as individual files (depending on backend).

In Gnus, there are tons of markings, even parallel
systems: e.g., one that tells the message have been
opened (or "read"), R, and one that tells it has been
answered, a.

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by notbob
notbob <[hidden email]> writes:

>> *c*Dx This is change the * marks to D marks (D for
>> deletion). Then execute (x).
>
> Works like a champ! Thank you, so much, Marco. ;)

Still, you don't need it with `dired-do-delete'.
Bind it to a key, say D, and you can do

    * s D

With this suggestion, it'd be

    * s * c * D x

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
In reply to this post by Emanuel Berg-4
Emanuel Berg <[hidden email]> writes:

> In Gnus, there are tons of markings, even parallel
> systems: e.g., one that tells the message have been
> opened (or "read"), R, and one that tells it has
> been answered, a.

Oups, that should be a capital A!

You Gnus, you learn.

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Robert Thorpe-2
In reply to this post by Emanuel Berg-4
Emanuel Berg <[hidden email]> writes:

> notbob <[hidden email]> writes:
>
>>> *c*Dx This is change the * marks to D marks (D for
>>> deletion). Then execute (x).
>>
>> Works like a champ! Thank you, so much, Marco. ;)
>
> Still, you don't need it with `dired-do-delete'.
> Bind it to a key, say D, and you can do
>
>     * s D
>
> With this suggestion, it'd be
>
>     * s * c * D x

I agree with Emanuel's suggestion The "* s D" is quicker.

Also, you do not need to re-map "D".  In Dired "D" is mapped to
dired-do-delete by default.

BR,
Robert Thorpe

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Emanuel Berg-4
Robert Thorpe wrote:

> I agree with Emanuel's suggestion The "* s D"
> is quicker.

Come to think of it, perhaps it is good it's
not *too* quick! I once deleted a file
accidentally. It wasn't terribly important,
just complete access to Fort Knox. Still, it
bothered me at the time having lost that
file...

> Also, you do not need to re-map "D". In Dired
> "D" is mapped to dired-do-delete by default.

Oh, yeah? And you don't think for such an
important key, setting it up twice can be
a virtue?

--
underground experts united
http://user.it.uu.se/~embe8573


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

Harry Putnam
Emanuel Berg <[hidden email]> writes:

> Oh, yeah? And you don't think for such an
> important key, setting it up twice can be
> a virtue?

hehe... that made my chuckle for the day.


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Delete marked files from dired

notbob
In reply to this post by notbob
On 2017-06-02, notbob <[hidden email]> wrote:
> On 2017-06-02, Marco Wahl <[hidden email]> wrote:

>> *c*Dx

This still works, perfectly, but now, how do I "force" delete, so I
don't hafta answer y/n fer all recursive (filled) directories?  ;)

nb  
12
Loading...