Skip to content

Commit

Permalink
Update examples.md (#603)
Browse files Browse the repository at this point in the history
Added example script to display URL and deletion token
  • Loading branch information
ArGei26 authored Feb 22, 2024
1 parent f207ec6 commit b518754
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
<a name="aliases"/>
Expand Down Expand Up @@ -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
```

0 comments on commit b518754

Please sign in to comment.