Re: uploading a file
Date: Fri, 25 Sep 2020 13:58:55 +0000 (UTC)
Thanks for your reply.
In a shell scrip.
datea=`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.csv4. 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
Thanks,
Mehran On Friday, 25 September 2020, 14:08:28 BST, Paul Gilmartin via curl-users <curl-users_at_cool.haxx.se> wrote:
> On 2020-09-25, at 06:17:39, mehran j wrote:
>
> I am trying to upload file using curl onto WebDav directory. The file is a csv file created every day. then the file will stamp with todays date at the end of it before upload, The CURL command is a part of Linux cron job which will run on daily bases to create and then transfer each days new csv file onto a WebDav directory..
>
> I am able to upload the file when the file date is set to be like 20200925 at the end of file name.
> curl --user user:password -T '/user/directory1/test_20200925.csv' 'https://web_cloud.com/directory1/directory2/'
>
> but I can not upload the file trying the following
>
> curl --user user:password -T '/user/directory1/test_*.csv' 'https://web_cloud.com/directory1/directory2/'
> or
> curl --user user:password -T '/user/directory1/test_$a.csv' 'https://web_cloud.com/directory1/directory2/'
>
> where a is set to be a data variable on this job.
>
A few questions/thoughts:
Are those the exact crontab commands, or are they in a shell script?
Can you get a log of the job as it ran with "set -x" if in a script?
Shell variables are not evaluated between apostrophes.
only between quotation marks, so:
curl --user user:password -T '/user/directory1/test_'"$a"'.csv' 'https://web_cloud.com/directory1/directory2/
Is "a" set in that same script? I don't believe cron jobs
inherit environment variables from the submitter.
-- 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-25