Skip to content

Instantly share code, notes, and snippets.

@Armatix
Last active November 4, 2023 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Armatix/a788f796c290d51a0e3272579f72b9c4 to your computer and use it in GitHub Desktop.
Save Armatix/a788f796c290d51a0e3272579f72b9c4 to your computer and use it in GitHub Desktop.
files to text | a one liner to convert files in current directory to a one liner shell script for copy pasting small files
#!/bin/bash
if [ $# -eq 0 ]; then
echo "Usage: $0 <directory/files>"
exit 1
fi
content=$(tar cf - --numeric-owner "$@" | gzip -c | base64) && echo " echo '$content' | base64 -d | gunzip -c | tar xf -"
@Armatix
Copy link
Author

Armatix commented Nov 4, 2023

here is the one liner:

sh <(echo 'content=$(tar cf - --numeric-owner "$@" | gzip -c | base64) && echo " echo '\''$content'\'' | base64 -d | gunzip -c | tar xf -"') .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment