TransWikia.com

How do I get a folder size in nautilus to include hidden files (dotfiles)?

Ask Ubuntu Asked by b264 on January 21, 2021

In Ubuntu (14.04) in the nautilus window (the file explorer) I can right-click on a folder and select Properties to see its size. However, this size does not include hidden files. (dotfiles) Is there any way to get a folder’s real size?

For example, it says 3 items, totalling 4.2 kB when, in fact, I am sure there are hundreds of gibibytes in this folder in dotfiles. The question is, how many hundreds?

edit:
To clarify, my question is specifically about including hidden files in the total size. So, how much disk space does the folder take up? Not reformatting the same number.

3 Answers

Nuatilus - File- preferences - check show hidden files

Correct answer by Dan on January 21, 2021

I solved this by adding a "Disk Usage" context menu entry to the folders in nautilus with "file manager actions" (package nautilus-extension-fma in ubuntu) that spawns the following script in a terminal to list the things I'm usually interested.

<rant>I absolutely can't find a reason why anyone would want to exclude hidden subfolders from the disk usage calculation. I mean, the only time I actually look at this is when I want to copy the folder somewhere and want to see if it still fits on the target drive. The other case is when I need to free some space. So, someone please give me even one good usage scenario where the size of hidden subfolders has to be excluded. This is just way too damn unintuitive imho.</rant>

~/.local/bin/disk-usage

#!/bin/bash

if ! tty -s; then
    DISK_USAGE_SPAWNED_TERMINAL=1 
    gnome-terminal --title="Disk Usage" --window --wait -- "${BASH_SOURCE}" "${@}"
    exit
fi

for path in "${@}"; do
    du -h --one-file-system --max-depth 1 --time "${path}"
    echo
done

if [ -n "${DISK_USAGE_SPAWNED_TERMINAL}" ]; then
    echo -e "ne[33;1;32mPress enter to close the windowe[33;0;37m"
    read xxx
fi

~/.local/share/file-manager/disk-usage.desktop

[Desktop Entry]
Type=Action
Name=Disk Usage
Profiles=Default;

[X-Action-Profile Default]
Exec=disk-usage %F
MimeTypes=inode/directory;

Answered by Moritz Molch on January 21, 2021

Also, I use ^H (ctl+h) in the folder view. Works on 16.04, 15.10, 14.04. for sure. This may give you the desired results and it is a toggle, once to show hidden files, once more to hide them.

Answered by James Leigh Smith on January 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP