Skip to content

Commit 2fccd44

Browse files
committed
2 parents 610e77c + 8370aac commit 2fccd44

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Python/Free_Disk_Space/Readme.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Free Disk Space
2+
Script to find free disk space present in the given path.
3+
4+
## How to use this script?
5+
6+
Just type the following in your command prompt:
7+
8+
python script.py
9+
10+
## Screenshot
11+
![demo](https://user-images.githubusercontent.com/56690856/99070578-8173a180-25d6-11eb-8eec-526624f80866.png)

Python/Free_Disk_Space/script.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import shutil
2+
3+
# Path
4+
path = input("Enter the path:")
5+
6+
# Get the disk usage statistics
7+
# about the given path
8+
stat = shutil.disk_usage(path)
9+
10+
# Print free space in the disk
11+
# shutil.disk_usage(path) returns a tuple with the attributes total, used and free in bytes, therefore the free disk space can be found in the index 2
12+
print("Free disk space present in the given path:"+str(stat[2])+" bytes")
13+

0 commit comments

Comments
 (0)