- Notifications
You must be signed in to change notification settings - Fork0
Enter and edit archives like they're directories
License
mle86/walk
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Version 2.3.0, January 2020
walk [-cyAq] [--]ARCHIVE
walk is a shell toolwhich allows you to treat archive files as directories.It completely unpacks an archive fileinto a temporary directory named to match the archive filename.It then spawns a new shell inside the new temporary directory,where you may proceed with any command line stuff you wish to do.After leaving this shell,walk asks you if you wish to re-pack the archivewith the contents of the temporary directory (which you may have changed).This way, you can interactively edit an existing archive,examine its content, add files to itand whatever else you wish to do with its contents.
Ifwalk is invoked on a non-existing filename or a non-file namewithout the-c option,it will print an error and exit.With the-c option,walk will accept non-existing filenamesand create a new, empty archive with that name.This can be used to create new archives from scratch.
This is just a shell script, it does not need any compilation.
# make install
This will copy the script to /usr/local/bin/walkand the man page to /usr/local/share/man/man.1/walk.1.gz.
walk uses thefile(1) tool to determine the archive file type.Currently, it supports handling these file types:
- tar
- tar, compressed with gzip/bzip2/xz(requires tar with built-in support for these compression formats,i.e. the -zjJ options)
- 7-zip(requires7z/7za/7zr binary)
- zip, jar(requireszip andunzip binaries)
- rar(requiresrar binary)
- cpio(requires the GNUcpio binary)
- deb, ar(requires the GNU binutilsar binary)
If the-c option has been used to create a new empty archive,thefile tool cannot be used internallyas there is no prior archive file to analyze.In this case the type is guessed from the filename extension instead.These extensions are recognized:
.tar,.tar.gz, .tgz,.tar.bz, .tbz, tar.bz2, .tbz2,.tar.xz, .txz,.7z,.zip, .jar,.rar,.deb,.cpio,.a
- -c
Create non-existingARCHIVEsinstead of exiting with an error. - -y
Assume `yes' for the two questionswalk asks after leaving the subshell.This means the original archive will always be recreated,and the temporary archive directory will always be removed afterwards. - -A
Store the working directory root (.) in the archive,not just its contents.Not all archivers support this(tar andcpio do).
Unpacking archives which contain the. directory entrycan cause the current directory's owner and/or mode to be changedby the archiver program,so use this option with caution. - -q
Quiet mode;suppresses most archiver outputsuch as filenames that are being extracted/compressed.
Beware that some archive types have their own idiosyncraciesconcerning file ownership:
- tar,zip, andcpio archivescan store file owner informations.Whenwalk is run as non-root,the owner informations are silently discarded.
- a archives (ar(1)) can store owner informations,but will always discard them on unpacking.
- 7z andrar archives don't store owner informations.
mle@box:~$walk test.tgz walk: unpacking archive ./httpd.conf ./rawdata ./uname ./subdir/ ./subdir/a1 ./subdir/a2 ./subdir/a3 walk: starting new shellmle@box:~/test.tgz$ mle@box:~/test.tgz$ls -la drwxr-xr-x 3 mle users 4,0K 2010-09-28 02:44 . drwx------ 24 mle users 4,0K 2010-09-28 02:53 .. -rw-r----- 1 mle users 30K 2010-09-28 02:42 httpd.conf -rw-r--r-- 1 mle users 437K 2010-09-28 02:41 rawdata drwxr-xr-x 2 mle users 4,0K 2010-09-28 02:45 subdir -rwxr-xr-x 1 mle users 14K 2010-09-28 02:44 unamemle@box:~/test.tgz$ls -l subdir/ -rw-r--r-- 1 mle users 300 2010-09-28 02:45 a1 -rw-r--r-- 1 mle users 400 2010-09-28 02:45 a2 -rw-r--r-- 1 mle users 500 2010-09-28 02:45 a3mle@box:~/test.tgz$rm subdir/a2mle@box:~/test.tgz$echo foo > barmle@box:~/test.tgz$>rawdatamle@box:~/test.tgz$ mle@box:~/test.tgz$exit walk: shell terminated. walk: Recreate archive test.tgz ? [Y/n]y walk: recreating archive ./httpd.conf ./bar ./rawdata ./uname ./subdir/ ./subdir/a1 ./subdir/a3 walk: Delete temporary directory? [Y/n]y walk: deleting temp dirmle@box:~$ mle@box:~$ls -l test* -rw-r--r-- 1 mle users 19K 2010-09-28 02:56 test.tgzmle@box:~$tar tzvf test.tgz -rw-r----- mle/users 30398 2010-09-28 02:42:48 ./httpd.conf -rw-r--r-- mle/users 4 2010-09-28 02:55:12 ./bar -rw-r--r-- mle/users 0 2010-09-28 02:55:24 ./rawdata -rwxr-xr-x mle/users 13900 2010-09-28 02:44:45 ./uname drwxr-xr-x mle/users 0 2010-09-28 02:54:50 ./subdir/ -rw-r--r-- mle/users 300 2010-09-28 02:45:28 ./subdir/a1 -rw-r--r-- mle/users 500 2010-09-28 02:45:35 ./subdir/a3
GNU GPL v3
Maximilian Eul <maximilian@eul.cc>(http://github.com/mle86/walk)
About
Enter and edit archives like they're directories