New answers tagged

2

No, in general this isn't possible. A FTP server usually has commands to get information about files and directories and to store, retrieve, delete and rename files. Commands to mount devices and to send messages to users are also standardized but not implemented in current servers. See the list of FTP commands on Wikipedia for details. No RFC mentions a ...


0

There are two bugs in your code: write(…, sizeof(char)); will only write "sizeof(char)" bytes (= most likely 1 or 2 bytes) to the FIFO, and not the size of the buffer as you probably intended my_fifo | will not read any data from the FIFO; you'll need to cat it at least. Since the call to writewill block until the script reads the data (and vice versa!), ...


1

First some comments/questions to get you thinking in a different way: (in other words, this started as a comment but became an actual answer somewhere along the way) Why are you even trying to extract the devicename element when you already know it - it's what you used to fetch the XML (with name=devicename in the URL)? Even if you didn't already have it, ...


9

Your problem is that the {...} expression is also valid shell syntax. For example, run: echo file/{one,two} And you get: file/one file/two So when you run: curl --user $USER:$PASS https://api.example.com/{foo,bar,baz} -o '#1.json' The {foo,bar,baz} is getting interpreted by your shell, and curl actually receives the command line: curl --user ...


0

Can you use curl at all? E.g. curl google.com. This would happen if you're in an environment like the University of York, where you're required to use the university proxy server, and direct connections are blocked. http://stackoverflow.com/questions/197904/how-do-i-use-cygwin-behind-the-corporate-firewall Technically the "network is unreachable" error ...


1

You could use curl -C - in a loop to get it to fetch only what has been added, and use tail -f on the local file to watch for the new data. The remote server has to allow for this sort of access. If it does not, use N=$(stat -c %s file) on the local file to find its size, then pipe the curl through tail -c +N | tee -a file to get the new stuff to the file ...


1

You're looking for the -C --continue-at and -f --fail arguments. curl -f -# -u user:password -k -C - -O https://log.my-app.com/log.2016-04-04.txt Without -f the output file will be appended with html from the 416 (invalid range) error.


0

I met same problem and I want to reuse the same filename whatever server side gives, in your case you may get the filename by basename ➸ basename 'http://mysite.com/myfile.jpg' myfile.jpg then you can write a helper bash function like: ➸ function download { name="$(basename $1)"; curl "$1" > "$name"; } ➸ download 'http://mysite.com/myfile.jpg' but ...



Top 50 recent answers are included