[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
du --files-from feature request
From: |
Aaron Peterson |
Subject: |
du --files-from feature request |
Date: |
Sun, 30 Nov 2008 16:16:51 -0800 |
Hi,
A feature request for du, a way to sum from a list of files without
doing tr \n \0
I had to sort some files and and needed to know how large the group of
files that I had found were.
I spend many hours trying to figure this out / and searching for solution.
It turns out that the \0 delimited list requirement was very painful.
I wish I could cat the output of find into du and get the total
btw, my find options included restricting it to type file,
http://www.mail-archive.com/address@hidden/msg396774.html
Geraud suggests a mode for du to to avoid situations like this:
Example:
$ find <dir> -<options> >files.list
# create a NL-separated list of files
$ wc -l files.list
# wc could not be used to count NUL-separated items
# (another more complex program would be needed)
$ sed -i -e <expr> files.list
# sed is designed for "regular" lines (NL-terminated)
$ wc -l files.list
$ emacs files.list
# editing a NUL-separated list in emacs would be inconvenient
$ tr $'\n' $'\0' <files.list >files0.list
# an additional command that I would like not to type
$ du -csb --from-files0 files0.list | tail -n1
# note the additional tail command that also could be avoided
# if there were an option to only display the grand total
$ IFS=$'\n' for i in `cat files.list`; do archive "$i"; done
# if the list is not too long
# does not work with NUL-separated lists (or I do not know how)
$ xargs -n1 -d \\n --arg-file=files.list archive
# if the list is very long
# here files0.list could be used
- du --files-from feature request,
Aaron Peterson <=