X-Loop: help-debbugs@HIDDEN
Subject: bug#32843: Feature request: rm -ir variant not asking about directories
Resent-From: nisse@HIDDEN (Niels =?UTF-8?Q?M=C3=B6ller?=)
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Wed, 26 Sep 2018 09:20:02 +0000
Resent-Message-ID: <handler.32843.B.153795358927798 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 32843
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: 32843 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-coreutils@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.153795358927798
(code B ref -1); Wed, 26 Sep 2018 09:20:02 +0000
Received: (at submit) by debbugs.gnu.org; 26 Sep 2018 09:19:49 +0000
Received: from localhost ([127.0.0.1]:54402 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1g55z3-0007EI-3s
for submit <at> debbugs.gnu.org; Wed, 26 Sep 2018 05:19:49 -0400
Received: from eggs.gnu.org ([208.118.235.92]:56151)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <nisse@HIDDEN>) id 1g55z1-0007E0-Ms
for submit <at> debbugs.gnu.org; Wed, 26 Sep 2018 05:19:48 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <nisse@HIDDEN>) id 1g55yv-0006RT-H7
for submit <at> debbugs.gnu.org; Wed, 26 Sep 2018 05:19:42 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level:
X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=disabled
version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:43925)
by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <nisse@HIDDEN>)
id 1g55yv-0006RN-Dl
for submit <at> debbugs.gnu.org; Wed, 26 Sep 2018 05:19:41 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:37521)
by lists.gnu.org with esmtp (Exim 4.71)
(envelope-from <nisse@HIDDEN>) id 1g55yu-0001OJ-LE
for bug-coreutils@HIDDEN; Wed, 26 Sep 2018 05:19:41 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
(envelope-from <nisse@HIDDEN>) id 1g55yt-0006Qa-Tp
for bug-coreutils@HIDDEN; Wed, 26 Sep 2018 05:19:40 -0400
Received: from mail.lysator.liu.se ([2001:6b0:17:f0a0::3]:39059)
by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)
(Exim 4.71) (envelope-from <nisse@HIDDEN>)
id 1g55yt-0006Oh-Io
for bug-coreutils@HIDDEN; Wed, 26 Sep 2018 05:19:39 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
by mail.lysator.liu.se (Postfix) with ESMTP id 21F8F4000E
for <bug-coreutils@HIDDEN>; Wed, 26 Sep 2018 11:19:33 +0200 (CEST)
Received: from armitage.lysator.liu.se (armitage.lysator.liu.se
[IPv6:2001:6b0:17:f0a0::83])
by mail.lysator.liu.se (Postfix) with SMTP id 0312440005
for <bug-coreutils@HIDDEN>; Wed, 26 Sep 2018 11:19:31 +0200 (CEST)
Received: by armitage.lysator.liu.se (sSMTP sendmail emulation);
Wed, 26 Sep 2018 11:19:31 +0200
From: nisse@HIDDEN (Niels =?UTF-8?Q?M=C3=B6ller?=)
Date: Wed, 26 Sep 2018 11:19:31 +0200
Message-ID: <nn7ej81uqk.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (berkeley-unix)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.3 (----)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.3 (-----)
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=20
--interactive=3Dnon-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
--=20
Niels M=C3=B6ller. PGP-encrypted email is preferred. Keyid 368C6677.
Internet email is subject to wholesale government surveillance.
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: nisse@HIDDEN (Niels =?UTF-8?Q?M=C3=B6ller?=) Subject: bug#32843: Acknowledgement (Feature request: rm -ir variant not asking about directories) Message-ID: <handler.32843.B.153795358927798.ack <at> debbugs.gnu.org> References: <nn7ej81uqk.fsf@HIDDEN> X-Gnu-PR-Message: ack 32843 X-Gnu-PR-Package: coreutils Reply-To: 32843 <at> debbugs.gnu.org Date: Wed, 26 Sep 2018 09:20:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. Your message has been sent to the package maintainer(s): bug-coreutils@HIDDEN If you wish to submit further information on this problem, please send it to 32843 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 32843: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D32843 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
X-Loop: help-debbugs@HIDDEN
Subject: bug#32843: Feature request: rm -ir variant not asking about directories
Resent-From: Bernhard Voelker <mail@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-coreutils@HIDDEN
Resent-Date: Wed, 26 Sep 2018 18:40:01 +0000
Resent-Message-ID: <handler.32843.B32843.15379871527947 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 32843
X-GNU-PR-Package: coreutils
X-GNU-PR-Keywords:
To: Niels =?UTF-8?Q?M=C3=B6ller?= <nisse@HIDDEN>, 32843 <at> debbugs.gnu.org
Received: via spool by 32843-submit <at> debbugs.gnu.org id=B32843.15379871527947
(code B ref 32843); Wed, 26 Sep 2018 18:40:01 +0000
Received: (at 32843) by debbugs.gnu.org; 26 Sep 2018 18:39:12 +0000
Received: from localhost ([127.0.0.1]:55638 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1g5EiN-000246-Kd
for submit <at> debbugs.gnu.org; Wed, 26 Sep 2018 14:39:12 -0400
Received: from mout.kundenserver.de ([217.72.192.75]:35475)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <mail@HIDDEN>) id 1g5EiL-00023p-UX
for 32843 <at> debbugs.gnu.org; Wed, 26 Sep 2018 14:39:10 -0400
Received: from [192.168.101.10] ([91.1.210.52]) by mrelayeu.kundenserver.de
(mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id
1MGA0o-1fzlc21K84-00GYUC; Wed, 26 Sep 2018 20:39:02 +0200
References: <nn7ej81uqk.fsf@HIDDEN>
From: Bernhard Voelker <mail@HIDDEN>
Openpgp: preference=signencrypt
Autocrypt: addr=mail@HIDDEN; prefer-encrypt=mutual; keydata=
xsBNBFPirzMBCACyzYldTjQ4ufFOkByY5Nn5USb5GFoL48nWBwNHjd9KUbtRRNlQiPNKd6hK
Gvd3BGi5aoFKA4ytfRk6jbAbW3jVb3R8wYaV08mOy4KVEKxqN4bxsXlMjNChXVR+rtKDmfI+
oPTL+cPH2X6gW4W02IRbVw0uUhNm6zEedC/gNrY/mTlf1enZ46jxZ7BTUZaG+kx38UMISIMB
zSzLRtdkwgmHj4jS3p1fF2cwRqLclIfMjKGpbNFPEXeXKWrCLcqHw78795eAR9q0YvrDkfIn
GdDBwfb3VM4NdulwIFzvYZMSXvSbbyPLB5YkHU5aAWQHUse4WlfT5ccDpbzUYldRAvF9ABEB
AAHNK0Jlcm5oYXJkIFZvZWxrZXIgPG1haWxAYmVybmhhcmQtdm9lbGtlci5kZT7CwHkEEwEC
ACMFAlPirzMCGwMHCwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRBGUC73lpFxle5wCACC
dbs0QaJ0vR3Sff2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CJ+OymCg==
Message-ID: <bbf9369d-0e2a-6a7d-4951-30a620e47f37@HIDDEN>
Date: Wed, 26 Sep 2018 20:39:01 +0200
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <nn7ej81uqk.fsf@HIDDEN>
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 8bit
X-Provags-ID: V03:K1:Yb49aW5gYACFHVx9OkJzJscUadNJnKwZLEpMVUDjymBDlA3gxl6
ZQhXv28HPnNB059ygT4wIbUyGvODd2tSaI9KwMkAAy6hxLpX8Hi4W93IpSpQjfGXpQfIDVt
HAmyO0QvviwB1GRwI+DX8L3gO1/Bccl5gUBjGcDTZfoJP28m+UoCkgCuyrIeFJdTnkjuo53
rxcHR+OhnGmMeWBJZyufA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:g5TY2ZELGV4=:QYWNT/77xW9ou5zPV5QlNc
sFD7jUH4rH9hnP3sPendx/IFHxk9HD9vA7CXhv9xkckXPP4utu0r/ZOZOZfj4eXEniYRC6Ffm
3sezQcqOOspvv82+ipOh7ah49Ifk4CtICPQT+DoJHGrRCmisNfIxYR5ozRQUtt1tdhV3Eb4pO
nRJxTNthukxDKWNdQt/YxCB4kWcjDkhbsCOhYmPjabk2vXTzuX9KNiOV+5zT80NP0OOBHgjTU
wCxWNo4dsDlTNES9Wi6ka8vqqA96AbyPaNUwjAlS9VnPrMqZbJ0ZY7jWVLltdzeM6PwOk0IT2
pS8A10e918Ldb2sZvkLkVSajT/lc3FcMcKsMY6KROOUDV96wuudWd8dK0a4iXN/aO5ZNHMq/f
sHfQuYndDVxEOUsyh/QX2mAIX31LOpD1MP0MrjAKILDpykvtdJKVoHrvzYEEJIYQa7XGwHH1W
/6jcpGLXnBpdKBbTlVYTGyjN9O2X588nPj6RLQzQHMLkN8uTiBBspTczEH1qLQPjWPP9WgNMv
lfpQEY8M1cXPgFvELTryf+Qv9YDbsltyENRRWwm68Tx2IfhAv1tPRLjHv5LqBgYDvI1+vep/4
I36Dpl9USr4MRoKZ9awfAGIrKyEkNYkWDstWGTAyYib1NMnWsduha4LsMXvmwDegYUI78hoWm
rnn0KB+Nl30u+U4VqCZ8u/+Jp05ysajJX3a5tYFVXgYFhAQHXS7F5WVZQxtq5kFWzKrWJG2oY
ihqnCJ3s0HWW/SOm
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
On 9/26/18 11:19 AM, Niels Möller wrote:
> 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.
This report includes several aspects. What exactly do you want to achieve?
If it is simply deleting all empty directories beneath DIR, then this can
already be achieved with existing tools/options:
# Prepare some directories in DIR: a/a/a, a/a/c, ..., c/c/c.
$ mkdir -p DIR/{a..c}/{a..c}/{a..c}
# Place a file in each dir level,
$ touch DIR/a/f DIR/b/a/f DIR/c/a/a/f
# Delete all empty directories
$ find DIR -depth -type d -empty -delete
# See what's left:
$ find DIR | xargs ls -ldog
drwxr-xr-x 5 4096 Sep 26 20:33 DIR
drwxr-xr-x 2 4096 Sep 26 20:33 DIR/a
-rw-r--r-- 1 0 Sep 26 20:33 DIR/a/f
drwxr-xr-x 3 4096 Sep 26 20:33 DIR/b
drwxr-xr-x 2 4096 Sep 26 20:33 DIR/b/a
-rw-r--r-- 1 0 Sep 26 20:33 DIR/b/a/f
drwxr-xr-x 3 4096 Sep 26 20:33 DIR/c
drwxr-xr-x 3 4096 Sep 26 20:33 DIR/c/a
drwxr-xr-x 2 4096 Sep 26 20:33 DIR/c/a/a
-rw-r--r-- 1 0 Sep 26 20:33 DIR/c/a/a/f
WRT changing the prompting in rm: IMO the existing functionality is already
quite complex, so adding more complexity and even an option needs some good
justification.
Have a nice day,
Berny
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.