Skip to content

Commit 4bbd7e6

Browse files
Merge branch 'master' into Patch-1
2 parents d8e39b2 + 3a73cc9 commit 4bbd7e6

File tree

4 files changed

+65
-1
lines changed

4 files changed

+65
-1
lines changed

File Downloader Script/README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# File Downloader Script
2+
3+
4+
A file downloader script is a program or script that automates the process of downloading files from a given URL. It enables users to retrieve files from the internet without manual intervention.
5+
6+
File downloader scripts typically use the HTTP or FTP protocols to establish a connection with a server hosting the desired file. They send a request to the server and retrieve the file's content, which is then saved to a local destination on the user's machine.
7+
8+
<br>
9+
10+
## Instructions 📝
11+
12+
### Step 1:
13+
14+
Save the Script: Save the script code provided earlier in a file with the desired name, such as file_downloader.py. Make sure to save it with the .py extension, indicating that it is a Python script.
15+
16+
### Step 2:
17+
18+
Install Dependencies: Ensure that you have the necessary dependencies installed. In this case, the script relies on the requests library. You can install it using the pip package manager. Open a command prompt or terminal and run the following command:
19+
20+
pip install requests
21+
22+
### Step 3:
23+
24+
Customize the Script (Optional): Depending on your specific requirements, you can customize the script. For example, you can modify the file_url variable to point to the URL of the file you want to download, and set the save_as variable to specify the destination path and filename.
25+
26+
### Step 4:
27+
28+
Run the Script: Open a command prompt or terminal, navigate to the directory where the script is saved, and run the following command:
29+
30+
python file_downloader.py
31+
32+
### Step 5:
33+
34+
Check the Output: The script will attempt to download the file from the specified URL and save it to the destination path. You will see either a success message or a failure message displayed in the command prompt or terminal, depending on the outcome of the download operation.
35+
36+
37+
### Step 6:
38+
39+
Verify the Downloaded File: After running the script, check the destination path specified in the save_as variable. If the download was successful, you should find the downloaded file at that location.
40+
41+
<br>
42+
43+
<hr>
44+
45+
> **Warning**
46+
>
47+
>Remember to update the file_url and save_as variables in the script to reflect your desired file URL and destination path before running the script.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import requests
2+
3+
def download_file(url, destination):
4+
response = requests.get(url, stream=True)
5+
if response.status_code == 200:
6+
with open(destination, 'wb') as file:
7+
for chunk in response.iter_content(chunk_size=1024):
8+
file.write(chunk)
9+
print("File downloaded successfully.")
10+
else:
11+
print("Failed to download file.")
12+
13+
# Example usage: Download a file from a URL
14+
file_url = 'https://example.com/path/to/file.txt'
15+
save_as = 'downloaded_file.txt'
16+
download_file(file_url, save_as)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests

SCRIPTS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
|94\. | Linked List | Linked List data Scripts are used to store and manage a collection of elements in a dynamic and flexible manner | [Take Me](./Linked%20List/) | [Himanshu Agarwal](https://github.com/himanshu-03)
9999
| 95\. | Searching Techniques | Searching techniques are scripts used to find a specific element or value within a collection of data. | [Take Me](./Searching%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
100100
| 96\. | Sorting Techniques | Sorting techniques are scripts that arrange a collection of data elements in a particular order, typically ascending or descending. | [Take Me](./Sorting%20Techniques/) | [Himanshu Agarwal](https://github.com/himanshu-03)
101-
| 98\. | | The script provided earlier is an "Image Manipulation Script" written in Python using the Pillow library. It allows you to perform basic image manipulations such as resizing, rotating, and flipping an image.. | [Take Me](./Image Manipulation Script/) | [Himanshu Agarwal](https://github.com/Abhinavcode13)
101+

0 commit comments

Comments
 (0)