Sponsored Content
Full Discussion: cURL and variables
Top Forums Shell Programming and Scripting cURL and variables Post 302535586 by fmSimplicity on Friday 1st of July 2011 07:18:06 AM
Old 07-01-2011
cURL and variables

I have a spent a day with Google trying to figure this one out and have decided its time to ask the experts...

I'm running OS X 10.6
I need to use cURL to FTP a file.

I have been successful send the file from the command line when I know the filename. My problem is that the filename changes with the date everyday and I need to make a bash script that is dynamic to either the date or the file contained in a folder. I will be running this script hourly.

The approach I am attempting is to set the name of the file contained in the folder into a variable and then placing that variable into the curl command.

I am sure my attempt is full of errors involving quotes, spaces, ect. and I greatly appreciate any help.

Thanks,
Drew

Code:
#/bin/bash
LOCALFILE= find  /Volumes/OS/Directory/*
curl -T $LOCALFILE ftp://123.123.123.123/remotedirectory/ --user username:password

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

curl

Aren't there any way to download files as below? For example, I want to download all .html files under the root directory of unix.com/ curl -O https://www.unix.com/*.html This won't work, but please tell me the way to do this. Well, the best way is to get the file list of the directory, but i... (6 Replies)
Discussion started by: Euler04
6 Replies

2. Shell Programming and Scripting

use of curl

I have to transfer a file from my aix box to another server using ftps protocol, how can i achieve this using curl preferably or any other utility. Regards Sandeep (0 Replies)
Discussion started by: jayawantsandeep
0 Replies

3. Programming

How to convert byteArray variables to HexaString variables for Linux?

Hello everybody, I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
Discussion started by: ritesh_163
2 Replies

4. Shell Programming and Scripting

Passing variables to cli curl

I have a script that uses cli curl, and it would be easier if it was possible to pass variables like this: curl -c $cookie -d $data www.********.comThis doesn't work, instead I have to generate a string and use eval. Is there another, easier way to pass variables to cli curl? (1 Reply)
Discussion started by: locoroco
1 Replies

5. Shell Programming and Scripting

Help with cURL

Hi all; first of all i need to clarify that i am new to apache2 server configuration and for some needs i want to transfer some files using curl to web directory,so please bear with me: following is the command i m running to transfer file to my web directory: curl -T "q"... (4 Replies)
Discussion started by: arien001
4 Replies

6. Shell Programming and Scripting

Running a script with multiple variables like 25 variables.

Hi All, i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way?? #!/bin/ksh ##script is sample.ksh age=$1 gender=$2 class=$3 . . .... (3 Replies)
Discussion started by: Lakshman_Gupta
3 Replies

7. Shell Programming and Scripting

Passing awk variables to bash variables

Trying to do so echo "111:222:333" |awk -F: '{system("export TESTO=" $2)}'But it doesn't work (2 Replies)
Discussion started by: urello
2 Replies

8. Shell Programming and Scripting

Sending awk variables into curl in a bash script

Hello experts! I have a file1 with the following format (yr,day, month, hour,minute): 201201132435 201202141210 201304132030 201410100110 ... What i want to do is to assign variables and then use them in the curl command to download the text of each event from a web page. What I have... (6 Replies)
Discussion started by: phaethon
6 Replies

9. Shell Programming and Scripting

HELP - loop a curl command with different variables from input file

Hi guys! Kind of new to bash scripting and now I'm stuck. I need to curl with these variables: "{ \"nodename\": \"$1\", \"ipaddress\": \"$2\", \"poolname\": \"$3\", \"port\": \"$4\", \"loadbalancer\" : \"$5\" }" and my input_file.txt contains server001 10.10.10.01 serverpool1 80... (4 Replies)
Discussion started by: yort
4 Replies

10. Shell Programming and Scripting

Curl not accepting spaces in script via variables

Hi All, I'm trying to run a script which issues rest commands via curl to an endpoint. If I put spaces in fields via something like insomnia, it works, but when I try from an input file, it's failing with a json error. while IFS=, read mname oname <------ my input file... (10 Replies)
Discussion started by: say170
10 Replies
CURL_MULTI_CLOSE(3)							 1						       CURL_MULTI_CLOSE(3)

curl_multi_close - Close a set of cURL handles

SYNOPSIS
void curl_multi_close (resource $mh) DESCRIPTION
Closes a set of cURL handles. PARAMETERS
o $mh -A cURL multi handle returned by curl_multi_init(3). RETURN VALUES
No value is returned. EXAMPLES
Example #1 curl_multi_close(3) example This example will create two cURL handles, add them to a multi handle, and process them asynchronously. <?php // create both cURL resources $ch1 = curl_init(); $ch2 = curl_init(); // set URL and other appropriate options curl_setopt($ch1, CURLOPT_URL, "http://www.example.com/"); curl_setopt($ch1, CURLOPT_HEADER, 0); curl_setopt($ch2, CURLOPT_URL, "http://www.php.net/"); curl_setopt($ch2, CURLOPT_HEADER, 0); //create the multiple cURL handle $mh = curl_multi_init(); //add the two handles curl_multi_add_handle($mh,$ch1); curl_multi_add_handle($mh,$ch2); $running=null; //execute the handles do { curl_multi_exec($mh,$running); } while ($running > 0); //close the handles curl_multi_remove_handle($mh, $ch1); curl_multi_remove_handle($mh, $ch2); curl_multi_close($mh); ?> SEE ALSO
curl_multi_init(3), curl_close(3). PHP Documentation Group CURL_MULTI_CLOSE(3)
All times are GMT -4. The time now is 09:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy