From b5187546b11ef52fb5099ec564ea1f5d5651eacb Mon Sep 17 00:00:00 2001 From: ArGei26 <159716703+ArGei26@users.noreply.github.com> Date: Thu, 22 Feb 2024 10:38:42 +0100 Subject: [PATCH] Update examples.md (#603) Added example script to display URL and deletion token --- examples.md | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/examples.md b/examples.md index 8e83245..c9fd7b1 100644 --- a/examples.md +++ b/examples.md @@ -6,6 +6,7 @@ * [Encrypting and decrypting](#encrypting-and-decrypting) * [Scanning for viruses](#scanning-for-viruses) * [Uploading and copy download command](#uploading-and-copy-download-command) +* [Uploading and displaying URL and deletion token](#uploading-and-displaying-url-and-deletion-token) ## Aliases @@ -311,5 +312,34 @@ https://transfer.sh/y0qr2c/a.log wget https://transfer.sh/y0qr2c/a.log 3) Windows download command: -Invoke-WebRequest -Uri https://transfer.sh/y0qr2c/a.log -OutFile a.log +Invoke-WebRequest -Uri https://transfer.sh/y0qr2c/a.log -OutFile a.log +``` +## Uploading and displaying URL and deletion token +```bash +# tempfile +URLFILE=$HOME/temp/transfersh.url +# insert number of downloads and days saved +if [ -f $1 ]; then +read -p "Allowed number of downloads: " num_down +read -p "Number of days on server: " num_save +# transfer +curl -sD - -H "Max-Downloads: $num_down" -H "Max-Days: $num_save"--progress-bar --upload-file $1 https://transfer.sh/$(basename $1) | grep -i -E 'transfer\.sh|x-url-delete' &> $URLFILE +# display URL and deletion token +if [ -f $URLFILE ]; then +URL=$(tail -n1 $URLFILE) +TOKEN=$(grep delete $URLFILE | awk -F "/" '{print $NF}') +echo "*********************************" +echo "Data is saved in $URLFILE" +echo "**********************************" +echo "URL is: $URL" +echo "Deletion Token is: $TOKEN" +echo "**********************************" +else +echo "NO URL-File found !!" +fi +else +echo "!!!!!!" +echo "\"$1\" not found !!" +echo "!!!!!!" +fi ```