File Bundles
August 14, 2015
It is sometimes convenient to package a group of files into a bundle, for transmission to a different computer or for archiving. Nowadays the most likely method involves tar and gzip, but in the past a “shell archive” was frequently used; the files, which are assumed to include only printable ascii characters, are collected into a single program file that can be executed to self-extract the included files.
Your task is to write a program that creates file bundles. When you are finished, you are welcome to read or run a suggested solution, or to post your own solution or discuss the exercise in the comments below.
Python is the new shell..
This creates a self extracting py file:
content of text1.TXT:
hello world
bye world
content of text2.TXT:
test with ‘qoutes’ and all other “stuf” should get ‘””” “””””IUYE754^!^#!%$#!%#*^ escaped..
result of above script is:
This can be run, result is original text files content again.
Two sample files: file1 and file2
file1 contents:
the quick brown fox jumped over the lazy dog
file2 contents:
foo bar baz quux
Usage: