Close

Catting files in numerical order

A project log for Silly software wishlist

Motivation to do some software projects by writing them down.

lion mclionheadlion mclionhead 06/14/2021 at 20:020 Comments

Continuing the theme of downloading segmented files

https://hackaday.io/project/138050/log/178403-download-a-segmented-video-file

The original segment downloader got updated to take a formatting code in the filename.  It replaces the formatting code with the number.

https://cdn.hackaday.io/files/1380505906331200/segments2.c

But once the segments are downloaded, you have to cat them into a single file.  The problem is numbered files get sorted with 1000 before 10.  This is a job for another program which takes another formatting code in the filename.  It cats all the files in a numerical range, replacing the formatting code with the number.

https://cdn.hackaday.io/files/1380505906331200/catnums.c

Discussions