Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Take Ownership of a Folder and sub folders?


  • Please log in to reply
24 replies to this topic

#1 pcpunk

pcpunk

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:07 PM

I'm having issues with two folders that got corrupted and need to delete them, but cannot figure out how to do so.  I tried to take ownership in KDE using the built in feature (Right Click Root Actions-Ownership to active user) but that did not work.  I'm trying to take ownership of them so I can Delete them, but it seems the Space in the Folders name is causing an issue when I use the terminal.  I think I've ran into this issue before but cannot remember how to resolve it.  Below is what I've done in Terminal.

 

Trying to delete from "SURFIN-2" USB, the "HOWARD COHEN-2" Folder.  Tried Removing it with terminal:

"sudo rm /media/chris/SURFIN-2/HOWARD COHEN-2/"

But that did not work either.

 

Here I'm trying to take owner ship of it so that maybe I can delete it

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:~ > sudo chown -R chris /media/chris/SURFIN-2/HOWARD COHEN-2/
chown: cannot access ‘/media/chris/SURFIN-2/HOWARD’: No such file or directory
chown: cannot access ‘COHEN-2/’: No such file or directory

Thanks, PCpunk


Edited by pcpunk, 11 October 2018 - 10:08 PM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


BC AdBot (Login to Remove)

 


#2 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:20 PM

I was able to rename the Folder but still cannot delete it with "rm'

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:/media/chris/SURFIN-2 > sudo rm dir HOWARDCOHEN-2
rm: cannot remove ‘dir’: No such file or directory
rm: cannot remove ‘HOWARDCOHEN-2’: Is a directory


Edited by pcpunk, 11 October 2018 - 10:23 PM.

sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#3 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:24 PM

Tried it this way also of course.

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:~ > sudo rm /media/chris/SURFIN-2/HOWARDCOHEN-2/
[sudo] password for chris: 
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/’: Is a directory

If it is a Directory then how will I "rm" it or Delete it?


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#4 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:27 PM

Next step:

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:~ > sudo rm -r mydir /media/chris/SURFIN-2/HOWARDCOHEN-2/
rm: cannot remove ‘mydir’: No such file or directory
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Desktop’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My Google Gadgets’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/Downloads/Yahoo Mail_files’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My MSN_files’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My Scans’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/Crosswords’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/My Stationery’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/Search’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/Old Read Only Spreadsheets’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Downloads’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Favorites’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/My Pictures/Camera Roll’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/My Scans’: Directory not empty


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#5 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:29 PM

It appears I got the last command wrong.

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:~ > rm -r /media/chris/SURFIN-2/HOWARDCOHEN-2/
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Desktop’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My Google Gadgets’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/Downloads/Yahoo Mail_files’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My MSN_files’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/My Scans’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/Crosswords’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/My Stationery’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/New York Times/Search’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Documents/Old Read Only Spreadsheets’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Downloads’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/Favorites’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/My Pictures/Camera Roll’: Directory not empty
rm: cannot remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/My Scans’: Directory not empty


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#6 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:39 PM

Next attempt

chris@chris-HP-Compaq-nx7400-EN352UTR-ABA:~ > sudo rmdir /media/chris/SURFIN-2/HOWARDCOHEN-2/
[sudo] password for chris: 
rmdir: failed to remove ‘/media/chris/SURFIN-2/HOWARDCOHEN-2/’: Directory not empty


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#7 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 11 October 2018 - 10:42 PM

The issue seems to be "Directory not empty" but there is nothing in there, except for a few folders which will not delete either.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#8 Nicholas_Kang

Nicholas_Kang

  • Malware Study Hall Junior
  • 271 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Penang
  • Local time:04:22 AM

Posted 12 October 2018 - 01:31 AM

You can't use rmdir to remove a directory which contains subdirectory.

 

Use sudo rm -rf (directory name)

 

May want to list down the permissions of the directories using ls -la first. See if you have the permission to access and modify them.


"When the product is free the real product is YOU."
 

An offer of free anti-virus or anti-malware software is essentially a marketing techniqueBottom line...it's all about generating revenue and finding new and creative ways to do so. As such, users may have to deal with occasional nagging pop-ups, nuisance advertising and prompts to upgrade to the paid version or purchase other products.

By using such free programs, you are essentially agreeing to the terms of the vendor's service which includes those annoying pop-ups and ads.
 
Read more here...


#9 technonymous

technonymous

  • Members
  • 2,516 posts
  • OFFLINE
  •  
  • Gender:Male
  • Local time:01:22 PM

Posted 12 October 2018 - 01:42 AM

Nick beat me to it. It would be -r for recursive delete sub directories with files in it.

 

sudo rm -r DirectoryName

 

To force..

 

sudo rm -rf DirectoryName



#10 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 12 October 2018 - 08:57 AM

And if there is a space in the name "Quotes" like this?

 

sudo rm -r "HOWARD COHEN-2"

 

Thanks guys, had to get some sleep when I left of with this.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#11 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 12 October 2018 - 09:26 AM

Weird that I'm having all these issues.  I was just trying to copy some files off a customers laptop with a live linux usb, and Linux Froze.  Then tried it again, and another freeze.  

 

Then I got the files copied and shutdown and linux locked up on shutdown.  Had to do a hard shutdown to end the session.  Each time, there were no files in those folders I've been trying to Delete.

 

Just tried it again, copied all the files to a new folder, and now can't unmount the USB?

 

I think I'll try another USB to copy to, but I just wonder if it is something in the customers files, because the customer got scammed and allowed remote access.

 

Arrrgggg, this is one of those days.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#12 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 12 October 2018 - 09:29 AM

I was also thinking about scanning these directories for malware, but creating a Kaspersky disk last night did not go well.  And, don't know if this is the problem.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#13 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 12 October 2018 - 10:01 AM

I must have buggered up a usb copying directories or something.  I did the file transfer again on a New USB and all is well!

 

Thanks for the support guys, I think I'll just wipe those drives as none of the commands provided will work.  I'm open to other ideas but if nothing works I will format.  Though as you can imagine there are quite a bit of files on my usb's.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 


#14 Al1000

Al1000

  • Global Moderator
  • 7,969 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Scotland
  • Local time:09:22 PM

Posted 12 October 2018 - 01:11 PM

So, what is the output of
rm -rf /media/chris/SURFIN-2/HOWARDCOHEN-2/
?
Also:
ls -l /media/chris/SURFIN-2/HOWARDCOHEN-2/


#15 pcpunk

pcpunk
  • Topic Starter

  • Members
  • 6,096 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Florida
  • Local time:04:22 PM

Posted 13 October 2018 - 10:47 AM

When I booted it from Windows it asked to do a scan the USB and it fixed it for the most part, so this is not such an emergency now.  I will post those outputs asap Al.  I will also attempt to Delete them after I run the commands as that was important to me.

 

One thing I don't understand is why Linux Live Session Froze.  I can only assume it was because I was running 18 series of Mint when I was on a very new computer.  Will post the specs asap.


sBCcBvM.png

Created by Mike_Walsh

 

KDE, Ruler of all Distro's

eps2.4_m4ster-s1ave.aes_pcpunk_leavemehere

 





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users