curl / Mailing Lists / curl-users / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

Re: uploading a file

From: mehran j via curl-users <curl-users_at_cool.haxx.se>
Date: Tue, 29 Sep 2020 09:22:38 +0000 (UTC)

 Thanks for your reply,
It  should upload a csv file with date stamp onto WebDev cloud directory.the date adding part to the file works fine. however, it seems CURL have problem uploading test_$a.csv file. if I give the file test_20200929.csv name CURL command upload the file without any problem onto destination.
Thanks,
Mehran On Friday, 25 September 2020, 17:41:48 BST, Paul Gilmartin via curl-users <curl-users_at_cool.haxx.se> wrote:
 
 On 2020-09-25, at 07:58:55, mehran j via curl-users <curl-users_at_cool.haxx.se> wrote:
>
> In a shell scrip.
>
> date
> a=`date '+%y%m%d'`;export a
>
> 2. Then script that runs creates  the new test.csv file
> 3. mv /directory/test.csv /directory/test_$a.csv
> 4. curl --user user:password -T '/user/directory1/test_$a.csv'  'https://webcloud/directory1/directory2/'
> 5. mv yesterday's test_date.csv file onto processed directory.
>
>
> The CURL bit is not working unless it like curl --user user:password -T  '/user/directory1/test_20200925.csv'  'https://webcloud/directory1/directory2/'
> ie: exact name for the csv file like test_20200925.csv rather than test_$a.csv

I'll revise my suggestion:

set -x  # Keep a log (but where does it go?)
date
a=`date '+%y%m%d'`;export a  # looks good.

# Then use quotation marks instead of apostrophes:
    curl --user user:password -T "/user/directory1/test_$a.csv" 'https://webcloud/directory1/directory2/'

-- gil

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette:  https://curl.haxx.se/mail/etiquette.html
  

-----------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-users
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2020-09-29