would like wget to give as result files named in order file1.txt file2.txt file3.txt and so on instead of being saved with their original names, while using linux centos 6,64. Which command would need to add for this? Thanks


The following will work:

wget -O file1.txt http://website/filename.txt
  • Hello Nasir, thanks for your reply. I am trying to mirror download a website (has many links). Then actually what I need is that each link comes organized in file1.txt then file2.txt and so on only growing the numbers. The suggestion you sent makes the full download be saved inside file1.txt only. Is there a way that each link comes separated just changing names organizedly autogenerating the number after word "file" until it ends the full download? Thanks – Joao Jan 15 '18 at 1:33
  • My code shows you how to save a file to a different filename which is what you asked. If you want each download to be saved in increasing increments, then you'll need to use a for loop. I've edited my answer to give you a basis for how to do so. You'll have to modify it for your needs. – Nasir Riley Jan 15 '18 at 1:53
  • Hello Nasir, when using wget -O does the file1.txt has a limit size while using linux or cmd or only the server memory is the limit? thank you – Joao Jan 15 '18 at 7:52
  • There is no limit on the file size. If you want a very simple way to do it then you can just write a script where you use the first code in my answer and just plug in the desired file names and links instead of having to modify a for loop. It wouldn't be as dynamic but it would do exactly what you want. – Nasir Riley Jan 15 '18 at 15:48
  • I took out the for loop as it doesn't work properly upon testing. – Nasir Riley Jan 15 '18 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.