bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Iterate over folders/files, suming sizes until limit


From: Wolfgang Laun
Subject: Re: [bug-gawk] Iterate over folders/files, suming sizes until limit
Date: Sun, 23 Jun 2019 19:03:33 +0200

If you are inviting tenders: could you please give us an address to which
we can submit an offer?

If you are not inviting tenders, I suggest that you derust your skills and
have a go at it, yourself.

Good luck
-W

On Sun, 23 Jun 2019 at 18:10, Roger <address@hidden> wrote:

> Well, I read the AWK/GAWK book ~10 years ago, and now have my first
> official
> use for AWK!  However, it's now Summer and am significantly rusty with
> skills.
> Since this is the only mailing list, and the description states, "... and
> everything else", I'll post my inquiry here.
>
> Summary: Need to list files/folders for recording to DVD/BD-R media, with
> a one
> line list of folders/files for passing to growisofs or mkisofs, limiting
> to
> media size.  (I'm really surprised nobody has something remotely
> completed,
> seemingly everyone rely upon the graphical front-ends! The folders contain
> multiple surveillance audio/video files.)
>
> Steps: Iterate over the current contents of a folder using "/bin/du", at a
> specified limit (eg. 46.5GB for 50GB BD-R media, adding the folder sizes
> until
> accumulated size is ~46.5GB) print a one line list of folders (for passing
> manually to growisofs), then continue repeating the previous commands
> until no
> more folders/files.
>
> This sounds like a simple and desired (database field sum) task for AWK,
> but
> likely requiring data from "du".
>
> The initial output will likely be:
>
> "./20170711 ./20170712 ./20170713 ./20170714",
>
> However I need to further format to mkisofs "-graft-points" feature:
>
> "20170711=./20170711  20170712=./20170712 20170713=./20170713
> 20170714=20170714/"
>
> Just need a little hand holding here as my skills are extremely rusty.
>
> I can imagine a slightly modified AWK program using "/bin/ls" for only
> files
> instead of "/bin/du" for just folders, or both.  I already have part of my
> problems solved, using "du -kh --max-depth=1 |sort -k 2" to find folder
> size
> and sort according to the year_month_dated folder names.
>
> I could likely easily whip-up one of my excellently written Bash scripts
> with
> "/bin/du" outputted temporary file to the /tmp folder without bugging
> anybody,
> but figure it's probably best/proper to do this all in AWK/GAWK script and
> have
> something posted for public use.
>
> Roger
>
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]