0

Some folders and files under my folder named Movies can't be deleted. I had a look and there is no longer a user even set on them to remove or edit them. Somehow it has removed itself 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 multiple 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 can't even chmod them from the GUI as there is no assigned username listed in the permissions tab even though I am the creator.

5
  • what's wrong with sudo rm -rf /path/to/file ?
    – Alvar
    Jan 20, 2014 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, 2014 at 14:57
  • then check this out, askubuntu.com/a/217255/10698
    – Alvar
    Jan 20, 2014 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, 2014 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, 2014 at 15:10

1 Answer 1

1

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.

5
  • 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, 2014 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, 2014 at 15:03
  • TYVM mate your a legend it worked!!!
    – mjared
    Jan 20, 2014 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, 2014 at 15:13
  • Or not, going by the comment I missed.
    – Darael
    Jan 20, 2014 at 15:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .