[SOLVED] Can't rm -rf a file because mageia thinks its a dir

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED] Can't rm -rf a file because mageia thinks its a dir

Postby joeyc » Jan 3rd, '13, 09:20

On Mageia 2, KDE

I tried to delete a whole bunch of folders using rm -rf <parent_dir> and they didn't delete completely.

So I went in and tried to delete it manually with rm -f <specific_file>

And it said "<specific_file> is a directory"

Where do I go from here?
Last edited by joeyc on Jan 22nd, '13, 09:59, edited 1 time in total.
joeyc
 
Posts: 55
Joined: Oct 22nd, '12, 05:44

Re: Can't rm -rf a file because mageia thinks its a dir

Postby tom_ » Jan 3rd, '13, 11:47

IIRC KDE has some problem deleting files and directories with special characters (non ASCII) in the name,
usually mc (midnight commander) can solve this kind of trouble
tom_
 
Posts: 423
Joined: Sep 3rd, '11, 12:26
Location: Porto Ercole, Italy

Re: Can't rm -rf a file because mageia thinks its a dir

Postby doktor5000 » Jan 3rd, '13, 21:05

tom_ wrote:IIRC KDE has some problem deleting files and directories with special characters (non ASCII) in the name,
usually mc (midnight commander) can solve this kind of trouble

Well, what does have KDE to do with deleting files via rm?

@joeyc: Please show the output of
Code: Select all
ls -lai <specific_file_you_could_not_delete>
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18061
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Can't rm -rf a file because mageia thinks its a dir

Postby joeyc » Jan 15th, '13, 09:32

This is what I got

[root@localhost Decapitated]# ls -lai The\ Negation/
total 4
15962 drwx------ 1 joey joey 4096 Dec 30 21:01 ./
15603 drwx------ 1 joey joey 0 Dec 13 23:33 ../
joeyc
 
Posts: 55
Joined: Oct 22nd, '12, 05:44

Re: Can't rm -rf a file because mageia thinks its a dir

Postby Mayavimmer » Jan 15th, '13, 12:46

Do you get any error messages when you try to remove the dir? If not, type the following to get the diagnostic return code:
Code: Select all
rmdir The\ Negation/ ; echo $?

Copypaste the output.
Mayavimmer
 
Posts: 27
Joined: Nov 30th, '12, 10:17

Re: Can't rm -rf a file because mageia thinks its a dir

Postby Ken-Bergen » Jan 15th, '13, 13:08

joeyc wrote:This is what I got

Code: Select all
[root@localhost Decapitated]# ls -lai The\ Negation/
total 4
15962 drwx------ 1 joey joey 4096 Dec 30 21:01 ./
15603 drwx------ 1 joey joey    0 Dec 13 23:33 ../
In Linux just as in Windows when working from the command line directory's and files with spaces in the name must be enclosed in quotes.
In your example the command is looking for the directory The\ which doesn't exist however "The\ Negation" will be found.
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: Can't rm -rf a file because mageia thinks its a dir

Postby Mayavimmer » Jan 15th, '13, 13:19

Ken-Bergen wrote:
joeyc wrote:This is what I got

Code: Select all
[root@localhost Decapitated]# ls -lai The\ Negation/
total 4
15962 drwx------ 1 joey joey 4096 Dec 30 21:01 ./
15603 drwx------ 1 joey joey    0 Dec 13 23:33 ../
In Linux just as in Windows when working from the command line directory's and files with spaces in the name must be enclosed in quotes.
In your example the command is looking for the directory The\ which doesn't exist however "The\ Negation" will be found.

Ken-Bergen, there's no fault here, I believe. joeyc may correctly specify The\ Negation, escaping the space with a backslash, or "The Negation", escaping the space and the rest of the characters (which do not need escaping here) with doublequotes. I think you misunderstood something.
Mayavimmer
 
Posts: 27
Joined: Nov 30th, '12, 10:17

Re: Can't rm -rf a file because mageia thinks its a dir

Postby Ken-Bergen » Jan 18th, '13, 06:38

Mayavimmer wrote:Ken-Bergen, there's no fault here, I believe. joeyc may correctly specify The\ Negation, escaping the space with a backslash, or "The Negation", escaping the space and the rest of the characters (which do not need escaping here) with doublequotes. I think you misunderstood something.
Yes I missed the fact that \ is an escape character not part of the file/directory name. :oops:
Ken
Ken-Bergen
 
Posts: 1019
Joined: Mar 30th, '11, 02:45
Location: Chilliwack, BC, Canada

Re: Can't rm -rf a file because mageia thinks its a dir

Postby joeyc » Jan 22nd, '13, 09:58

Mayavimmer - you genius! That worked! By the way the output was "0"
Code: Select all
rmdir The\ Negation/ ; echo $?
joeyc
 
Posts: 55
Joined: Oct 22nd, '12, 05:44

Re: [SOLVED]Can't rm -rf a file because mageia thinks its a

Postby Mayavimmer » Jan 22nd, '13, 10:12

That worked! By the way the output was "0"

Yes, the output was produced by the echo command and it says that the preceding rmdir command completed successfully. Any nonzero output would signal failure instead.
Mayavimmer
 
Posts: 27
Joined: Nov 30th, '12, 10:17


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest