3

I have an old Windows directory that I have not been able to remove using Windows processes so I moved to Slax Linux to try and remove it.

When removing the directory I receive

Cannot remove [directory] operation not supported.

after using the rm -rf [directory] command.

I have received the following in a permission query:

drwx------ 1 root root 12288 Mar  3 16:48 Program Files
drwx------ 1 root root 28672 Mar  3 16:48 Program Files (x86)
drwx------ 1 root root 20480 Mar  3 16:48 ProgramData

And am logged in with the root user. It still doesn't seem to allow me to delete.

I can move these files to the trash, but when I try to empty it, I am told I cannot delete the files.

When trying to use lsattr -d [directory] exam_a I get:

lsattr: Inappropriate ioctl for device While reading flags on Program Files
lsattr: No such file or directory while trying to stat exam_a

Any other ideas?

This is a Windows.old directory that is taking up 25GB on a drive that has 3GB left, I need the space and am trying to remove it. There is nothing on it that I need, but the directory is in a drive that is my Windows C:\ drive, so I can't format and start over.

  • Just to be sure, have you tried to chkdsk the drive on Windows before doing those attempts on Linux? – Andrea Lazzarotto Mar 4 '17 at 23:09
-1

I would try these first:

  chattr -i [directory]  
  chattr -a [directory]  

chattr changes file (and directory) attributes on a Linux file system

  chattr +[option] adds an attribute  
  chattr -[option] removes and attribute  

The append-only flag 'a' prevents removing a directory and any files or directories created within it.

An item with the 'i' attribute cannot be modified: it cannot be deleted or renamed.

  • 1
    Rather than telling the user to read the fine manual, you should explain in your answer what these commands do and why they might solve the problem. Please do not respond in comments; edit your answer to make it clearer and more complete. – Scott Mar 4 '17 at 6:03
  • Thanks, I appreciate the feedback. I have added additional explanation. The OP's use of lsattr made me think they might already be familiar with the chattr command, but possibly not, and more explanation is also good for others visiting this question/answer. – MikeD Mar 4 '17 at 14:19
  • 2
    This is not relevant since the file is on an NTFS filesystem. – Gilles 'SO- stop being evil' Mar 4 '17 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.