Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, I have a problem where I would like to know the total size of a directory. That is, the size of all the files inside the directory and any ...
  1. #1
    Just Joined!
    Join Date
    Mar 2009
    Posts
    1

    Directory size permissions problem

    Hi, I have a problem where I would like to know the total size of a directory. That is, the size of all the files inside the directory and any sub-directories, recursive. When I run du -sm (dir) I get some permissions denied errors on some of the directories existing within (dir). Does this mean that there could be a 30G file, for example, inside one of the directories that I don't have permissions to, and this 30G does not show up on the final report for the size of (dir)? If so, is there any way, besides getting permissions to those directories, I can count the total size?

    Thanks in advance for any replies.

  2. #2
    Linux Guru
    Join Date
    Nov 2007
    Location
    Córdoba (Spain)
    Posts
    1,513
    Quote Originally Posted by Hoyoki View Post
    Hi, I have a problem where I would like to know the total size of a directory. That is, the size of all the files inside the directory and any sub-directories, recursive. When I run du -sm (dir) I get some permissions denied errors on some of the directories existing within (dir). Does this mean that there could be a 30G file, for example, inside one of the directories that I don't have permissions to, and this 30G does not show up on the final report for the size of (dir)?
    Yes.

    If so, is there any way, besides getting permissions to those directories, I can count the total size?

    Thanks in advance for any replies.
    No. The whole point of doing chmod -x dir is that you can't enter that directory. If you could do it via a tool like du then nothing stops you from converting du into cd and entering the directory.

    If you don't mind the user seeing that kind of info, then in first place there's no point into disable the x flag on a given directory. Then just chmod -r all the files into it, so you can reach the dir and see the file metadata, but not their contents.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...