transfer.sh icon indicating copy to clipboard operation
transfer.sh copied to clipboard

how can delete a my file with curl

Open thebardockgames opened this issue 3 years ago • 8 comments

thebardockgames avatar Aug 19 '22 17:08 thebardockgames

Hi, the procedure described below works for me: https://github.com/dutchcoders/transfer.sh#x-url-delete https://github.com/dutchcoders/transfer.sh#deleting

Where do you stuck?

toastie89 avatar Sep 07 '22 18:09 toastie89

and if we upload without run this grep part, how to delete the file without this specific header value !?

bahammut avatar Sep 12 '22 00:09 bahammut

@bahammut there's no way without knowing the delete token

if you uploaded on transfer.sh you can try asking @stefanbenten

aspacca avatar Sep 12 '22 02:09 aspacca

You can always reach out via the contact-us form on the website and we'll be happy to help with getting files deleted, if proven ownership of the file exists 👍

stefanbenten avatar Sep 12 '22 11:09 stefanbenten

It's very easy to forget to grep the file because grep is not included in the getting started command.

Would it be a good idea to show the deleted url in upload response? Like:

curl --upload-file ./hello https://transfer.sh/hello.txt
Download URL: https://transfer.sh/hello.txt/BAYh0/hello.txt
Delete URL: https://transfer.sh/hello.txt/BAYh0/hello.txt/PDw0NHPcqU

reorx avatar Sep 19 '22 05:09 reorx

@reorx unluckily change the output of the command will be a breaking change that we are not willing to do

maybe we can improve te documentation in the getting started command: any suggestion is welcome

aspacca avatar Sep 19 '22 05:09 aspacca

You are right, there must be many scripts that relies on the output to parse the download url.

My suggestion to document is to add a -v after curl, making the command looks like below:

curl -v —upload-file hello https://transfer.sh/hello.txt

On Mon, Sep 19, 2022 at 13:27 Andrea Spacca @.***> wrote:

@reorx https://github.com/reorx unluckily change the output of the command will be a breaking change that we are not willing to do

maybe we can improve te documentation in the getting started command: any suggestion is welcome

— Reply to this email directly, view it on GitHub https://github.com/dutchcoders/transfer.sh/issues/502#issuecomment-1250585622, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADDDVE2NPYUNQEXLMWRYWDV672VXANCNFSM57BMEOBQ . You are receiving this because you were mentioned.Message ID: @.***>

-- Xiao Meng

reorx avatar Sep 19 '22 05:09 reorx

I have for a while trying to figure out the delete token.

Is there a way to show regular and delete token in one curl command?

When i use curl -sD - --upload-file test.txt https://transfer.sh/test.txt | grep "x-delete-token" i only the delete token in a whole link. But i would like to have one url and one line with token only.

Sorry but I'm new to the whole curl and grep thing.

UPDATE: ended up with this in my fish shell function

curl -sD - --upload-file $argv https://transfer.sh/$argv | grep 'transfer' | awk -F'/' 'NR==1{print "Delete Token: "$6};END{print $0}'

this is what i use in termux function so i can copy to clipboard but also see the url and delete token in the teminal -

curl -sD - --upload-file $argv https://transfer.sh/$argv | grep 'transfer' | awk -F'/' 'NR==1{print "Delete Token: "$6};END{print $0}' > curl_transfer.log && tail -n1 curl_transfer.log | sed -z 's/\n$//' | termux-clipboard-set && cat curl_transfer.log

and this is for use on my linux computer (i have this as a IF function all togather).

curl -sD - --upload-file $argv https://transfer.sh/$argv | grep 'transfer' | awk -F'/' 'NR==1{print "Delete Token: "$6};END{print $0}' > curl_transfer.log && tail -n1 curl_transfer.log | xclip -sel clip 2>/dev/null; cat curl_transfer.log

if someone was intrested on how i did it. Please give feedback is something is off or could have done better.

Dan1jel avatar Sep 21 '22 07:09 Dan1jel

@Dan1jel , @reorx

you might want to give a look at the sample bash/zsh function on the readme https://github.com/dutchcoders/transfer.sh#bash-and-zsh-with-delete-url-delete-token-output-and-prompt-before-uploading :)

@Dan1jel if it doesn't not work for fish and you are able to improve, you're welcome to open a PR :)

aspacca avatar Sep 22 '22 09:09 aspacca

@Dan1jel , @reorx

you might want to give a look at the sample bash/zsh function on the readme https://github.com/dutchcoders/transfer.sh#bash-and-zsh-with-delete-url-delete-token-output-and-prompt-before-uploading :)

@Dan1jel if it doesn't not work for fish and you are able to improve, you're welcome to open a PR :)

Did not see that, thanks for the tip, dont know if i would be able to do better tho, my thought was to make an zip to upload instead of several files, thats why my line is small and minimalist but yea, that sample was really nice :)

Dan1jel avatar Sep 22 '22 10:09 Dan1jel