ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I had a look on several sites to get more information on the cURL command, but have found very long and comprehensive descriptions which don't necessarily tell me what I want to know. I thought you might have the answers to my questions, and, moreover, that your answers could be of great use to a great number of people out there. So, I'll put my questions to you. If you can answer them, great! If not, well, nobody knows everything...
What does '-o' do?
How does the "pic#1.jpg" work? The file name will begin with 'pic' and end with '.jpg', but I don't understand the middle part: How about the '#' and '1' bit? What does the '#1' do?
I noticed that the file is saved in the folder you are in when you do the command. Are there other ways of saving the file in a specific directory?
If you don't know how many jpg pictures there are, is there a way of telling cURL to stop when it encounter a 'non-jpg' file? For instance, if there are 18 jpgs and the '...19.jpg' doesn't exist.
Is there a similar command for DOS in Windows? Does cURL work in DOS?
Are there any useful sites for downloading web sites? For example, a Table of Contents and all of its associated links?
Another problem encountered when saving chapters is that the notation isn't necessarily consistent: You could have Chapter 1, Section 1.1, 1.2, 1.3, 1.3.1, 1.3.2, 1.3.2.1, 1.4, Chapter 2, 2.1, etc. It's cool when all the links work even when you're not connected to the Net (after saving the file)... It can work if you put everything in the same folder. Any advice here?
Any other useful features, options or functionality?
I must say, I've only started learning the command line a couple months ago, and I'm very impressed indeed!
The #1 is replaced with the number from the range [001-125]. If you had a second range it would be #2.
curl 'http://www.mysite.org/collection[1-9]/pic[001-125].jpg' -o "collection#1_pic#2.jpg" would safe files named "collection1_pic001.jpg" ... "collection9_pic125.jpg".
The -o is the argument for an output filename. Otherwise the standard output is used. If you use -O then the file is saved by the same name:
curl -O 'http://www.mysite.org/pic[001-125].jpg'
To clone a website use wget.
The wget manpage has examples.
If anybody has any answers to some of my other questions, I'd certainly appreciate it. What I'd like to be able to do is to save an entire website, that is, all of the links of a table of contents of a webbook, for example.
Command for converting filenames from upper- to lower-case
Another similar or somewhat related question...
I need to convert all of the files in a directory to lowercase. The file names are DOGGY.PAS, KITTY.PAS, and I need to convert them all to lower case (doggy.pas, kitty.pas). Is there an easy way of doing this from the terminal? (It's a bunch of Pascal mini-programs/exercises whose file names are all in uppercase). I couldn't find a solution on the web. I read something about IUCLC, but don't think it applies to this sort of thing...
Another general question. In the info and manual pages, if I have a question about a topic but don't know the commands, options and/or arguments, how do you go about finding them?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.