Add support for directories in the alias #383

Closed
opened 2026-01-19 18:30:07 +00:00 by michael · 0 comments
Owner

Originally created by @ngryman on GitHub.

Hi guys,

I think it would be nice to add directory support in the given alias. We could first create a tarball of it and then upload it. Something like this:

transfer() {
  file=$1

  if [[ -d $1 ]]; then
    file=$(basename $1).tar.gz
    tar cvzf $file $1
  fi

  # write to output to tmpfile because of progress bar
  tmpfile=$( mktemp -t transferXXX )
  curl --progress-bar --upload-file $file https://transfer.sh/$(basename $file) >> $tmpfile
  cat $tmpfile;
  rm -f $tmpfile;
}

What do you think?

Originally created by @ngryman on GitHub. Hi guys, I think it would be nice to add directory support in the given alias. We could first create a tarball of it and then upload it. Something like this: ``` bash transfer() { file=$1 if [[ -d $1 ]]; then file=$(basename $1).tar.gz tar cvzf $file $1 fi # write to output to tmpfile because of progress bar tmpfile=$( mktemp -t transferXXX ) curl --progress-bar --upload-file $file https://transfer.sh/$(basename $file) >> $tmpfile cat $tmpfile; rm -f $tmpfile; } ``` What do you think?
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: dutchcoders/transfer.sh#383