tb-scripts: add ,split-1G utility for splitting large files
Add a new utility script for splitting files into 1GB chunks: ,split-1G - File splitting wrapper - Splits one or more files into 1GB chunks with numeric suffixes - Uses split(1) with --bytes=1G for consistent chunk sizes - Generates 5-digit numeric suffixes (.00000, .00001, etc) for up to 99,999 parts - Outputs verbose progress information during splitting - Fails fast with set -e to catch errors during multi-file operations - Added to tb-scripts package with coreutils as runtime dependency This is useful for preparing large files for upload to services with file size limits, or for splitting backups/archives into manageable pieces. Example usage: ,split-1G large-backup.tar.gz # Creates: large-backup.tar.gz.00000, large-backup.tar.gz.00001, ... 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -20,5 +20,10 @@ pkgs.symlinkJoin {
|
|||||||
runtimeInputs = [ pkgs.zip ];
|
runtimeInputs = [ pkgs.zip ];
|
||||||
text = builtins.readFile ./zipdir;
|
text = builtins.readFile ./zipdir;
|
||||||
})
|
})
|
||||||
|
(pkgs.writeShellApplication {
|
||||||
|
name = ",split-1G";
|
||||||
|
runtimeInputs = [ pkgs.coreutils ];
|
||||||
|
text = builtins.readFile ./split-1G;
|
||||||
|
})
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
7
pkgs/tb-scripts/split-1G
Executable file
7
pkgs/tb-scripts/split-1G
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
for f in "$@"; do
|
||||||
|
split --verbose --suffix-length=5 --bytes=1G --numeric-suffixes "$f" "$f."
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user