Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.os.linux.misc > #69440
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Newsgroups | comp.os.linux.misc |
| Subject | Re: shell command for deleting all subdirectories |
| Date | 2025-07-06 20:24 +0200 |
| Message-ID | <ujrqjlx5to.ln2@Telcontar.valinor> (permalink) |
| References | (4 earlier) <104blo6$1jp9r$1@dont-email.me> <0d5ojlxe7s.ln2@Telcontar.valinor> <104cjpr$1q66s$1@dont-email.me> <7iaqjlxcuv.ln2@Telcontar.valinor> <104e7a2$29enk$2@dont-email.me> |
On 2025-07-06 18:12, Nuno Silva wrote: > On 2025-07-06, Carlos E.R. wrote: > >> On 2025-07-06 03:33, Lawrence D'Oliveiro wrote: >>> On Sat, 5 Jul 2025 19:53:04 +0200, Carlos E.R. wrote: >>> >>>> Why not do >>>> >>>> rm -r ~/Music/* >>>> >>>> ? >>> >>> If any file/dir names in there have spaces or even (shudder) newlines, >>> then word-splitting may not produce the results you expect. >> >> Would that problem be different in: >> >> rm -r ~/Music/* >> >> compared to: >> >> cd ~/Music/* >> rm -r * > > I think so, yes. One problem is the same and present in both, word > splitting will happen after the expansion of *. > > The second case has the added problem that the expanded elements have no > prefix, so if they happen to match an option or a different valid > argument to rm, they will be interpreted that way. If you're lucky, > it'll be just invalid and you get a "file not found". > > If you're unlucky and on a non-GNU system, or old (how old?) GNU > system, you may have files named, I don't know, something like > > "List of books / movies -fr 2024.pdf" > > then two things will happen for sure, one of the arguments is going to > be -f, and another is going to be /. And -r is already there and the > whole command becomes a giant "rm -rf /". Brrrr... :-( > > (I just hope nobody ever writes a document with "--no-preserve-root" in > the title, or it might end up in a filename somewhere...) > > > > (If someone reading this does not understand what is going on here, ask, > don't try.) > -- Cheers, Carlos.
Back to comp.os.linux.misc | Previous | Next — Previous in thread | Next in thread | Find similar
shell command for deleting all subdirectories bilsch01 <usenet@writer.com> - 2025-07-05 05:26 -0700
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-05 13:28 +0100
Re: shell command for deleting all subdirectories Charlie Gibbs <cgibbs@kltpzyxm.invalid> - 2025-07-05 13:36 +0000
Re: shell command for deleting all subdirectories Bill Ubuntu <writer@usenet.org> - 2025-07-05 06:45 -0700
Re: shell command for deleting all subdirectories Jason H <jason_hindle@yahoo.com> - 2025-07-05 17:00 +0000
Re: shell command for deleting all subdirectories "Carlos E.R." <robin_listas@es.invalid> - 2025-07-05 19:53 +0200
Re: shell command for deleting all subdirectories Jason H <jason_hindle@yahoo.com> - 2025-07-05 21:48 +0000
Re: shell command for deleting all subdirectories "Carlos E.R." <robin_listas@es.invalid> - 2025-07-06 01:29 +0200
Re: shell command for deleting all subdirectories Andy Burns <usenet@andyburns.uk> - 2025-07-06 09:14 +0100
Re: shell command for deleting all subdirectories "Carlos E.R." <robin_listas@es.invalid> - 2025-07-06 15:31 +0200
Re: shell command for deleting all subdirectories Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-06 01:33 +0000
Re: shell command for deleting all subdirectories "Carlos E.R." <robin_listas@es.invalid> - 2025-07-06 15:33 +0200
Re: shell command for deleting all subdirectories Nuno Silva <nunojsilva@invalid.invalid> - 2025-07-06 17:12 +0100
Re: shell command for deleting all subdirectories "Carlos E.R." <robin_listas@es.invalid> - 2025-07-06 20:24 +0200
Re: shell command for deleting all subdirectories Richard Kettlewell <invalid@invalid.invalid> - 2025-07-06 19:56 +0100
Re: shell command for deleting all subdirectories Nuno Silva <nunojsilva@invalid.invalid> - 2025-07-11 18:36 +0100
Re: shell command for deleting all subdirectories Rich <rich@example.invalid> - 2025-07-06 16:44 +0000
Re: shell command for deleting all subdirectories Nuno Silva <nunojsilva@invalid.invalid> - 2025-07-06 18:20 +0100
Re: shell command for deleting all subdirectories Fritz Wuehler <fritz@spamexpire-202507.rodent.frell.theremailer.net> - 2025-07-06 23:57 +0200
Re: shell command for deleting all subdirectories Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-06 23:15 +0000
Re: shell command for deleting all subdirectories Eric Pozharski <apple.universe@posteo.net> - 2025-07-07 13:16 +0000
Re: shell command for deleting all subdirectories rbowman <bowman@montana.com> - 2025-07-05 18:12 +0000
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-06 09:05 +0100
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-05 14:46 +0100
Re: shell command for deleting all subdirectories Bill Ubuntu <writer@usenet.org> - 2025-07-05 06:36 -0700
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-05 14:50 +0100
Re: shell command for deleting all subdirectories Ralf Fassel <ralfixx@gmx.de> - 2025-07-07 10:47 +0200
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-07 09:59 +0100
Re: shell command for deleting all subdirectories Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-07-07 13:32 +0200
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-07 15:00 +0100
Re: shell command for deleting all subdirectories Marc Haber <mh+usenetspam1118@zugschl.us> - 2025-07-07 16:36 +0200
Re: shell command for deleting all subdirectories The Natural Philosopher <tnp@invalid.invalid> - 2025-07-07 16:05 +0100
Re: shell command for deleting all subdirectories Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-07 21:53 +0000
Re: shell command for deleting all subdirectories Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-06 01:35 +0000
Re: shell command for deleting all subdirectories Nuno Silva <nunojsilva@invalid.invalid> - 2025-07-06 03:09 +0100
Re: shell command for deleting all subdirectories Lawrence D'Oliveiro <ldo@nz.invalid> - 2025-07-06 03:13 +0000
csiph-web