Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Some folders and files under my folder named Movies cant be deleted I had a look and there is no longer a user even set on them to remove or edit them. Some how it has removed it self as me being the creator of them I was listed as being about to last time I checked. I can't simply delete the folder by cli as I have files in there I need still but I need to delete the folders that are in there. I could transfer the files out and then delete it but that would take to long to transfer them and I need to delete the existing folders now to free up space.

So my question is how can I delete multiply folders without an assigned user creator or any as none is listed anymore?

My user account won't let me change the permission because for some reason my username was removed from the folders and files so I cant even chmod them from the GUI as there is no assigned username listed in the permissions tab even tho I am the creator.

share|improve this question
    
what's wrong with sudo rm -rf /path/to/file ? –  Alvar Jan 20 at 14:46
    
that will remove everything in folder I only want to remove some of the contents not all of it –  mjared Jan 20 at 14:57
    
then check this out, askubuntu.com/a/217255/10698 –  Alvar Jan 20 at 14:58
    
I get how you can use this for files, how can this be done for folders when there is no extension? –  mjared Jan 20 at 15:04
    
There's a nifty syntax for such things using curly brackets - although I maintain that it's a good idea to use chown first as mentioned in my answer for future convenience. That said: some/folder/file{a,b,c,0..2} will be expanded by the shell to some/folder/filea some/folder/fileb some/folder/filec some/folder/file0 some/folder/file1 some/folder/file2 - that example should cover both ways of using it (ranges and individual specification). This can be nested and can be combined with the use of the wildcard character * for an awful lot of expressiveness. –  Darael Jan 20 at 15:10
add comment

1 Answer

up vote 1 down vote accepted

One option, assuming the old account is gone for good, is to change the whole thing to belong to thy own account. Obviously this can't be done from the GUI, as thou'lt need to be root, but thou canst always issue sudo chown -R your_username: /path/to/folder. Omitting the : will also work, but will leave the group-owner set to what it was before - which may of course be desired.

The advantage of this over deleting them directly from the terminal, is that those files which remain will be owned by thy user afterwards.

The disadvantage, of course, is that if some things are meant to be owned by another user, they'll need changing back.

share|improve this answer
    
my account is still there my problem is my account was somehow removed from permissions so I cant delete them, ATM there is no user even listed on these folders and files. I have nfi why this as happened as the account is still active. –  mjared Jan 20 at 15:01
    
@JaredMoore Well, then, this is definitely the way to go: It will set the user- and group-ownership IDs to the ones appropriate to thy current user, restoring thy permissions on them. –  Darael Jan 20 at 15:03
    
Thanks mate will try that now. –  mjared Jan 20 at 15:07
    
TYVM mate your a legend it worked!!! –  mjared Jan 20 at 15:12
1  
It may be necessary to follow it up with chmod -R u+rwX /path/to/folder if the permission bits as well as the ownership have got messed up. Note that the X is uppercase so as to apply only to directories. –  Darael Jan 20 at 15:13
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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