GNU bug report logs - #32843
Feature request: rm -ir variant not asking about directories

Previous Next

Package: coreutils;

Reported by: nisse <at> lysator.liu.se (Niels Möller)

Date: Wed, 26 Sep 2018 09:20:02 UTC

Severity: wishlist

Full log


View this message in rfc822 format

From: nisse <at> lysator.liu.se (Niels Möller)
To: 32843 <at> debbugs.gnu.org
Subject: bug#32843: Feature request: rm -ir variant not asking about directories
Date: Wed, 26 Sep 2018 11:19:31 +0200
I have a large directory tree where most but not all directories are
empty, and where I might want to keep a few of the existing files.

I can use rm -ir to get rm to ask me for each file if it should be
deleted. But it also asks questions like

  rm: descend into directory 'foo'?
  rm: remove directory 'foo'?

to which I'd always say yes (and then attempts to delete any non-empty
directory fails with a clear warning message).

It would be less tedious if the questions about directories were
suppressed. A reasonable command line flag might be 

  --interactive=non-dir

(If there are any entries which are niether files nor directories, e.g,
a named pipe, I'd want rm to ask, hence "non-dir" rather than "file").

Another variant which would be useful is to traverse a directory tree
and recursively delete all empty directories, without asking any
questions. Would make sense as a --recursive/-r flag to rmdir, rather
than a new option to rm.

I'm using GNU coreutils 8.28, which doesn't seem to have these features.

Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.





This bug report was last modified 6 years and 263 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.