Tải nhiều tệp bằng curl
Chúng ta có 100 tệp dữ liệu được lưu ở các URL đặt tên theo chuỗi dài. Kéo sang phải để xem toàn bộ URL.
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
Để tránh phải gõ lại các URL dài nhiều lần, bạn hãy tải tất cả các tệp này chỉ bằng một lệnh curl.
Bài tập này là một phần của khóa học
Xử lý dữ liệu trên Shell
Hướng dẫn bài tập
- Tải cả 100 tệp dữ liệu chỉ với một lệnh
curl. - In (liệt kê) tất cả các tệp đã tải trong thư mục.
Bài tập tương tác thực hành trực tiếp
Hãy thử làm bài tập này bằng cách hoàn thành đoạn mã mẫu này.
# 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