Simple upload script with user input?

I’ve written a simple bash script for a friend to make uploading to OneDrive simple. It isn’t working, though, as I intend.

I want to allow the user to double click the bash file, be prompted to drag a folder into the window, name the target, and BAM. It uploads.

I’m getting a “directory not found” on tests I’m running.


echo "Drag the folder you want to upload to your OneDrive into this window."

read folder

echo "Type the name of the folder you want it to end up in, on OneDrive."

read target

echo "Working..."

rclone copy -v $folder onedrive:$target

echo "All done!"

Here’s the error output I get:

ERROR : : error reading source directory: directory not found

It makes three attempts and fails. I’ve tried enclosing with quotes and without quotes, but can’t seem to get this to work.

rclone copy -v "$folder" onedrive:"$target"

I’d quote like that

1 Like