使用 curl 下載多個檔案
我們有 100 個資料檔案,分別存放在具有連號命名的長網址中。向右捲動即可看到完整網址。
https://s3.amazonaws.com/assets.datacamp.com/production/repositories/4180/datasets/files/datafile001.txt
https://s3.amazonaws.com/assets.datacamp.com/production/repositories/4180/datasets/files/datafile002.txt
......
https://s3.amazonaws.com/assets.datacamp.com/production/repositories/4180/datasets/files/datafile100.txt
為了避免一再輸入冗長的網址,我們想用一個 curl 指令一次下載所有這些檔案。
本練習屬於課程
在 Shell 中進行資料處理
練習說明
- 使用一個
curl指令下載全部 100 個資料檔案。 - 將所有下載的檔案印出到目錄中。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Download all 100 data files
curl ___ https://s3.amazonaws.com/assets.datacamp.com/production/repositories/4180/datasets/files/datafile___.txt
# Print all downloaded files to directory
ls datafile*.txt