Introduction

Part 6

Archives, transfer and media: move a project without losing the method

Files become truly useful when you can package, verify, transfer and transform them. The terminal lets these operations become one reviewable chain instead of a sequence of unrelated windows and dialogs.

An archive is more than a smaller file

A good archive is a checkpoint: a named, inspectable snapshot you can keep before a risky operation, send to another person or move to another host. TAR and ZIP both package trees, but the value is the same — many paths become one object with a clear boundary.

Create archives inside backups, then inspect the resulting file with stat. Keeping backups separate from the source tree makes later automation much easier to read.

install md mf dir stat tar zip upload img exif attr copy
cd lil-playground
md archive-demo
mf archive-demo/README.txt
mf archive-demo/config.ini
md backups
tar archive-demo backups/archive-demo.tar -f
stat backups/archive-demo.tar

TAR and ZIP solve related but different transport problems

TAR is a straightforward archive container and in lil-terminal is intentionally uncompressed. ZIP combines the archive with compression and is widely convenient for interchange. GZIP in the zip module is for a single file, not a replacement for a directory archive.

Do not choose by habit alone. TAR is excellent when you want a simple faithful bundle; ZIP is convenient when compression and broad desktop interoperability matter.

TARtree → one archiveSimple uncompressed project snapshot
ZIPtree → compressed archiveCompact exchange with common desktop tools
GZIPone file → compressed streamCompression for a single file
tar backups/archive-demo.tar -l
tar backups/archive-demo.tar -t
zip archive-demo backups/archive-demo.zip -f -6
zip backups/archive-demo.zip -t

List and test before you extract

Both archive modules can show contents and test integrity without writing extracted files. This is an important terminal habit: receiving an archive does not mean immediately unpacking it into the current project.

For practice, extract into restore-test rather than on top of the source. Then inspect the restored tree. A separate destination turns restoration into a reversible comparison instead of a leap of faith.

md restore-test
tar backups/archive-demo.tar restore-test
dir 2 restore-test -G -a

Upload and download are a boundary, not a different universe

upload opens the browser file chooser but lands the selected files in the same filesystem your terminal commands already understand. download goes the other direction. Downloading a directory automatically creates a temporary TAR for transfer and removes that temporary package afterward.

This is useful on shared hosting because the workflow stays continuous: receive a file, inspect it, transform it, archive it and send the result back without switching to a separate control-panel file manager.

md media
upload media
download backups/archive-demo.zip -n archive-demo-backup.zip
download archive-demo

Inspect an image before changing pixels

Upload a disposable JPEG as media/photo.jpg. img reports format, dimensions and size; exif -i adds camera-oriented metadata when available; attr ... dimensions gives a compact portable dimension check.

Not every image has EXIF data, and EXIF is not the image itself. Treat metadata as optional context. The dependable first question is still simple: what file is this, how large is it, and what dimensions does it actually have?

img media/photo.jpg
exif media/photo.jpg -i
attr media/photo.jpg dimensions

Build the batch workflow on a copy first

A realistic media routine is often: inspect originals copy to a working directory resize convert inspect the result. The example creates a WebP version bounded to 1600x1600 at quality 82, then shows the directory batch form.

The exact dimensions and quality are not universal recommendations. They are parameters of your own publishing process. Once you have tested them on representative images, the terminal makes applying the same rule to a hundred files no harder conceptually than applying it to one.

copy media media-work
img media-work/photo.jpg -s 1600x1600 -t webp -q 82 -o media-work/photo.webp
img -f media-work "*.jpg" -s 1600x1600 -t webp -q 82
dir 1 media-work -G -a

A delivery package can be rebuilt instead of remembered

If every release needs a TAR checkpoint, a ZIP for someone else and a quick integrity test, save those steps. The script below recreates the package and tests both archives every time.

A repeatable package routine prevents “which checkbox did I use last time?” from becoming part of the release process. Your procedure becomes text that can be reviewed and versioned.

Keep this as a script

Save this as package-project.lil. It rebuilds two archive forms with explicit replacement, tests them and leaves a compact listing of the backup directory. It deliberately does not upload or transform images, because interactive selection and media policy belong to the human-controlled part of the workflow.

#lil
@install md dir stat tar zip
cd lil-playground
md backups
tar archive-demo backups/archive-demo.tar -f
tar backups/archive-demo.tar -t
zip archive-demo backups/archive-demo.zip -f -6
zip backups/archive-demo.zip -t
dir 1 backups -G