Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Save and load? #137

Open
lachesis opened this issue Jul 26, 2022 · 5 comments
Open

Save and load? #137

lachesis opened this issue Jul 26, 2022 · 5 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@lachesis
Copy link

Is there a way to save the scan result and reimport it for interactive view? This would be similar to ncdu's -o and -f options.

@Byron Byron added enhancement New feature or request help wanted Extra attention is needed labels Jul 27, 2022
@Byron
Copy link
Owner

Byron commented Jul 27, 2022

That would be interesting for some use-cases for sure and quite straightforward to implement I presume if one uses standard Rust serialization.

@gosuwachu
Copy link
Contributor

@lachesis Can you describe your use case? It would help prfioritize this issue.

@CouldBeThis
Copy link

Not that anyone asked me but I do occasionally use pdu's --json-output and --json-input to save and load results. You can produce different visualizations for the same data.

My main simple use case is that I have a bunch of old spinning HDDs connected to a low resource computer. I added HDDs slowly over time as I needed space so there was no scheme of what files were where. Too chaosy. So it was required to learn how space was being used then plan a way to move things around.

  • Takes a long time even in rust so in this way I can set a task to collect the data then come back and sort through it later.
  • Don't have to keep a terminal/ssh/tmux or any other kind of session active to preserve the information
  • If you close a window you don't have to start completely fom scratch as I did on a few occasions.
  • The json files can be moved to a better computer which is more pleasant to work on.

It's kind of like using locate instead of find. locate periodically creates a database then lets you very quickly search through it, whereas find starts from scratch every time. If your file-set is relatively stable the speed can be an acceptable trade off.

And since it's json I guess you can do all kinds of things with it.

I think it would be cool if dua could do this because it's the one I like the best but tbh it is also acceptable to use the other available tools. As an intermediary, loading the jsons generated by pdu would be cool because dua does a much superior job of visualizing. But only once in a very long while with a very specific use case.

@Byron
Copy link
Owner

Byron commented Apr 14, 2024

Definitely CC @piotrwach :).

@piotrwach
Copy link
Contributor

I also have few use cases where having ability to load a file system walk from a file would be very useful:

  1. I work with remote machines where I don't want to run dua. I could instead run some shell command that would list all the files that I could then load in dua on my machine. E.g.
$ ssh remote_host find /home -ls > listing.txt
$ dua i --from-file listing.txt
  1. I sometimes need to analyse what is taking space in my Amazon S3 bucket. For that I would like to run something similar as in 1) e.g.
$ s3cmd ls --recursive "s3://mybucket/*" > listing.txt
$ dua i --from-file listing.txt

Unfortunately the formats of listing.txt in both cases are quite different:

find:

$ find . -ls
19692507        0 drwxr-xr-x    7 pwach            staff                 224  9 Nov 07:39 .
19692508        8 -rw-r--r--    1 pwach            staff                1000  9 Nov 07:39 ./1000bytes
19692511        0 drwxr-xr-x    3 pwach            staff                  96  9 Nov 07:39 ./empty-dir
19692512        0 -rw-r--r--    1 pwach            staff                   0  9 Nov 07:39 ./empty-dir/.gitkeep

vs

s3cmd

$ s3cmd ls --recursive "s3://mybucket/*"
2019-06-14 17:08         123  s3://mybucket/a/1.png
2019-06-15 17:08         456  s3://mybucket/b/2.png

For what it is worth, I have changed dua to achieve 2) already, but since it is not universal / probably a bit out of scope of this project I think we need more universal way of doing this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants