Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shell Script and Curl Help - VPS to Google Drive - I have script need help
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Shell Script and Curl Help - VPS to Google Drive - I have script need help

rrrrrr Member

Hi Guys,

I found a cool script which do a fantastic job with Curl.. It uploads predefined file to google drive root.

https://gist.github.com/deanet/3427090

so you just type sh s2g.sh and it will upload file to google drive. I made a change

file="$1" So now it read file path from command like sh s2g.sh filename.tar.gz and it uploads that particular file

but now i have two problems..

How can I upload multiple files from same folder like "*.tar.gz" and how can I set a target directory in Google Drive?

Regards

Comments

  • nickyzainickyzai Member, Host Rep

    Write a bash script, for loop, and it should get you good.

  • Having the same post twice doesn't help your cause

  • rrrrrr Member

    @nickyzai said:
    Write a bash script, for loop, and it should get you good.

    I couldnt figure it out thats why I asked here!> @Void_Whisperer said:

    Having the same post twice doesn't help your cause

    It was mistake sir! Sorry for that.

  • rrrrrr Member

    https://gist.github.com/rakeshr/11255588

    Here is the script which will let u set a destination folder..

    still puzzle about files loop.. like

    i have 10 files in a folder

    how can I do

    sh s2g.sh filename1.tar.gz
    sh s2g.sh filename2.tar.gz

    Regards

  • blackblack Member
    edited April 2014

    you're passing filenames as arguments. This means you'll need something like

    for file in $* ; do
    #upload $file here
    done
    
  • nickyzainickyzai Member, Host Rep

    Or just use this in the directory that you want to upload your files:

    for file in $(ls); do if [ -f $file ]; then sh s2g.sh $file; fi done

    **your s2g.sh must be in the same level of directory that you want to upload.
    **s2g.sh must be executable.

  • rrrrrr Member

    Ok I got almost everything complete.. but thing is that.. whenever I upload file.. it creates new file on Google Drive.

    Can you guys @nickyzai @black please check the following code.. let me know.. what should I do to overwrite the file or a way to delete that file.

    http://pastebin.com/Z2a2yYAq

    Regards

Sign In or Register to comment.