emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* directory tree size browsing with column view
@ 2009-10-24 13:45 Michael Brand
  2009-10-24 15:51 ` James TD Smith
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Brand @ 2009-10-24 13:45 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

I would like to use the column view for browsing a hierarchical tree with a summed up property like e. g. the directory sizes (inclusive cluster waste and subdirectories from `du -sk`) of a directory tree. Just similar (only unsorted) to the upper left pane of this GUI screenshot of WinDirStat here
http://windirstat.info/images/windirstat.jpg

Let me make an example how I think to do the same with column view when given a directory with the two shell outputs

----------------------------------------
$ ls -lR dir_node
total 16
drwxr-xr-x  2 usr  grp      136 Oct 24 12:00 a
drwxr-xr-x  2 usr  grp      102 Oct 24 12:00 b
-rw-r--r--  1 usr  grp     9070 Oct 24 13:00 t.txt

dir_node/a:
total 2400
-rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
-rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt

dir_node/b:
total 16
-rw-r--r--  1 usr  grp     4535 Oct 24 12:00 z.txt
----------------------------------------

----------------------------------------
$ find dir_node -type d -exec du -sk {} \;
1220	dir_node
1200	dir_node/a
8	dir_node/b
----------------------------------------

For this I would like to have `some software' which uses the path to this directory `dir_node' as input and produces the following output file

----------------------------------------
-*- mode: org; eval: (org-columns) -*-
#+STARTUP: odd hidestars
#+PROPERTY: size
#+COLUMNS: %20ITEM %size{+}

* dir_node
*** a
    :PROPERTIES:
    :size: 1200
    :END:
    -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
    -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
*** b
    :PROPERTIES:
    :size: 8
    :END:
    -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 z.txt
*** .
    :PROPERTIES:
    :size: 12
    :END:
    -rw-r--r--  1 usr  grp     9070 Oct 24 13:00 t.txt
----------------------------------------

Opening this file in org-mode using column view now is comfortable to browse and can look e. g. like here

----------------------------------------
ITEM                 | size |
* dir_node           | 1220 |
*** a                | 1200 |
    :PROPERTIES:...
    -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
    -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
*** b                | 8    |...
*** .                | 12   |...
----------------------------------------

where all not of interest can be left hidden and one can see easily that
  - the directory `a' is by far the largest
  - most of the disk usage is caused only by the file dir_node/a/y.txt.
  - etc

I would be able to implement this `some software' in a shell script (if I would take the necessary time some day) but not within Emacs itself which would be easier to use and IMHO would not be concerned that much with portability issues.

What do you think?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: directory tree size browsing with column view
  2009-10-24 13:45 directory tree size browsing with column view Michael Brand
@ 2009-10-24 15:51 ` James TD Smith
  2009-10-24 20:52   ` James TD Smith
  0 siblings, 1 reply; 4+ messages in thread
From: James TD Smith @ 2009-10-24 15:51 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode

Hi Michael,

On 2009-10-24 15:45:32(+0200), Michael Brand wrote:
> Hi all,
> 
> I would like to use the column view for browsing a hierarchical tree with a
> summed up property like e. g. the directory sizes (inclusive cluster waste and
> subdirectories from `du -sk`) of a directory tree. Just similar (only
> unsorted) to the upper left pane of this GUI screenshot of WinDirStat here
> http://windirstat.info/images/windirstat.jpg
> 
> Let me make an example how I think to do the same with column view when given
> a directory with the two shell outputs
> 
> ----------------------------------------
> $ ls -lR dir_node
> total 16
> drwxr-xr-x  2 usr  grp      136 Oct 24 12:00 a
> drwxr-xr-x  2 usr  grp      102 Oct 24 12:00 b
> -rw-r--r--  1 usr  grp     9070 Oct 24 13:00 t.txt
> 
> dir_node/a:
> total 2400
> -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
> -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
> 
> dir_node/b:
> total 16
> -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 z.txt
> ----------------------------------------
> 
> ----------------------------------------
> $ find dir_node -type d -exec du -sk {} \;
> 1220	dir_node
> 1200	dir_node/a
> 8	dir_node/b
> ----------------------------------------
> 
> For this I would like to have `some software' which uses the path to this
> directory `dir_node' as input and produces the following output file
> 
> ----------------------------------------
> -*- mode: org; eval: (org-columns) -*-
> #+STARTUP: odd hidestars
> #+PROPERTY: size
> #+COLUMNS: %20ITEM %size{+}
> 
> * dir_node
> *** a
>     :PROPERTIES:
>     :size: 1200
>     :END:
>     -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
>     -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
> *** b
>     :PROPERTIES:
>     :size: 8
>     :END:
>     -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 z.txt
> *** .
>     :PROPERTIES:
>     :size: 12
>     :END:
>     -rw-r--r--  1 usr  grp     9070 Oct 24 13:00 t.txt
> ----------------------------------------
> 
> Opening this file in org-mode using column view now is comfortable to browse
> and can look e. g. like here
> 
> ----------------------------------------
> ITEM                 | size |
> * dir_node           | 1220 |
> *** a                | 1200 |
>     :PROPERTIES:...
>     -rw-r--r--  1 usr  grp     4535 Oct 24 12:00 x.txt
>     -rw-r--r--  1 usr  grp  1217312 Oct 24 12:00 y.txt
> *** b                | 8    |...
> *** .                | 12   |...
> ----------------------------------------
> 
> where all not of interest can be left hidden and one can see easily that
>   - the directory `a' is by far the largest
>   - most of the disk usage is caused only by the file dir_node/a/y.txt.
>   - etc
> 
> I would be able to implement this `some software' in a shell script (if I
> would take the necessary time some day) but not within Emacs itself which
> would be easier to use and IMHO would not be concerned that much with
> portability issues.
> 
> What do you think?

Have you looked at org-fstree? http://repo.or.cz/w/org-fstree.git

It generates an org tree for the contents of a directory. It doesn't have an
option to include the size or other file attributes as properties as the moment,
but I don't think this would be hard to add. Andreas and I have been working on
it quite a lot over the last week, I'll see if I can add an option which would
do what you want.

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: directory tree size browsing with column view
  2009-10-24 15:51 ` James TD Smith
@ 2009-10-24 20:52   ` James TD Smith
  2009-10-25  8:02     ` Michael Brand
  0 siblings, 1 reply; 4+ messages in thread
From: James TD Smith @ 2009-10-24 20:52 UTC (permalink / raw)
  To: Michael Brand; +Cc: emacs-orgmode

Hi Michael,

On 2009-10-24 16:51:17(+0100), James TD Smith wrote:
> On 2009-10-24 15:45:32(+0200), Michael Brand wrote:
> > I would like to use the column view for browsing a hierarchical tree with a
> > summed up property like e. g. the directory sizes (inclusive cluster waste and
> > subdirectories from `du -sk`) of a directory tree. Just similar (only
> > unsorted) to the upper left pane of this GUI screenshot of WinDirStat here
> > http://windirstat.info/images/windirstat.jpg

[snip]

> > What do you think?
> 
> Have you looked at org-fstree? http://repo.or.cz/w/org-fstree.git
> 
> It generates an org tree for the contents of a directory. It doesn't have an
> option to include the size or other file attributes as properties as the moment,
> but I don't think this would be hard to add. Andreas and I have been working on
> it quite a lot over the last week, I'll see if I can add an option which would
> do what you want.

OK, I have added support for including file attributes as properties to
org-fstree. You will need to use the merge_jtd_smiths_patch branch.

Once you have loaded org-fstree put the following in an orgfile and fill in the
directory name.

--8<---------------cut here---------------start------------->8---
* Disk usage
  :PROPERTIES:
  :COLUMNS: %80ITEM %size{+}
  :END:
#+BEGIN: fstree :dir "<dir name>" :file-attributes (size)
#+END:
--8<---------------cut here---------------end--------------->8---

Hit C-c C-c on the #+BEGIN line to fill in the file details. 

James

--
|-<James TD Smith>-<email/ahktenzero@mohorovi.cc>-|

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: directory tree size browsing with column view
  2009-10-24 20:52   ` James TD Smith
@ 2009-10-25  8:02     ` Michael Brand
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Brand @ 2009-10-25  8:02 UTC (permalink / raw)
  To: James TD Smith; +Cc: emacs-orgmode

> OK, I have added support for including file attributes as properties to
> org-fstree. You will need to use the merge_jtd_smiths_patch branch.
> 
> Once you have loaded org-fstree put the following in an orgfile and fill in the
> directory name.
> 
> --8<---------------cut here---------------start------------->8---
> * Disk usage
>   :PROPERTIES:
>   :COLUMNS: %80ITEM %size{+}
>   :END:
> #+BEGIN: fstree :dir "<dir name>" :file-attributes (size)
> #+END:
> --8<---------------cut here---------------end--------------->8---
> 
> Hit C-c C-c on the #+BEGIN line to fill in the file details.

Thanks a lot for org-fstree, that's the column view directory tree browser I have been looking for. And also thanks for the related change to combine the Emacs function file-attributes with org-fstree which I just have tried out.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-10-25  8:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-24 13:45 directory tree size browsing with column view Michael Brand
2009-10-24 15:51 ` James TD Smith
2009-10-24 20:52   ` James TD Smith
2009-10-25  8:02     ` Michael Brand

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).