-5

How can I delete a folder with whitespace in its name, but without quoting the folder name? I also need to be prompted to confirm the deletion. I know how to do it like this:

rm -ri /home/user/'my folder'

But how can I do this without quotes? Is there another way?

terdon
  • 100,812
Jay B
  • 23
  • 3
    From the help page: "You should only ask practical, answerable questions based on actual problems that you face." Imposing "limitations" on an answer (such as no quotes, the options must be in a certain order etc.) is not a practical solution to a real problem. – Artur Meinild Feb 15 '21 at 11:12
  • @ArturMeinild this question is practical and answerable. It is a bad question because the OP wants us to do their homework for them, but it is not off topic. – terdon Feb 15 '21 at 12:06
  • @terdon "It is a bad question" - it hopefully means that it does not belong on the site, right? – Levente Feb 15 '21 at 12:06
  • @terdon I don't think it's practical, based on the artificial limitations imposed upon the answer. But let's agree to disagree, I didn't vote for the question to be removed, but I think the score on the question and my comment speaks for itself. – Artur Meinild Feb 15 '21 at 12:09
  • It has been discussed on meta on several occasions that homework questions are OK, as long as they uphold a certain standard. So the problem isn't that it's a homework question; IMO the problem is that it's badly phrased and imposes certain limitations on the wanted answer. – Artur Meinild Feb 15 '21 at 12:17
  • @ArturMeinild I am new to Linux and learning Linux. I am doing an edx course and this is a question from there that I could not solve. I am not very much familiar with the code of conduct, type of discussions here so I thought someone like you could help me. However thanks for letting me know. I will do it inline next time. Thanks. – Jay B Feb 15 '21 at 12:30
  • @Levente too. Thanks. – Jay B Feb 15 '21 at 12:31
  • @JayB I'm not very familiar with the rules on https://unix.stackexchange.com/ but you coluld make an attempt there. Their interests are supposed to be way more broad regarding generic Linux topics. As far as I know AskUbuntu tends to have more tight guidelines to keep questions on-topic for people having practical issues involving Ubuntu specifically. – Levente Feb 15 '21 at 12:37
  • Thanks @Levente for a good suggestion. I'll move there. – Jay B Feb 15 '21 at 12:41
  • @JayB no! Please don't. It will have exactly the same issues there. This is as on topic here as it is on [unix.se]. – terdon Feb 15 '21 at 12:43
  • 1
    @Levente please don't suggest sites if you don't know their scope well. And, again, speaking as an ex Ask Ubuntu mod and current Unix & Linux mod, I assure you that this is on topic on both sites and there is no reason to move. Yes, the artificial restraints are silly but they are also completely irrelevant. The slash at the end is not a problem and nor is the order of options. The only relevant one is not using quotes, so this question becomes "how can I escape whitespace in the shell without quoting" which is both on topic and answerable. See my edit. – terdon Feb 15 '21 at 12:43

1 Answers1

2

Ciao...

try to use escape char

rm -ri /home/user/my\ folder