Python Matplotlib Script to List All Files with Size and Take Screenshot & Save as PNG Image Report
849 views
Jun 1, 2025
Get the full source code of application here: https://codingshiksha.com/python/python-matplotlib-script-to-list-all-files-with-size-and-take-screenshot-save-as-png-image-report/
View Video Transcript
0:00
uh hello guys welcome to this video so
0:02
in this video I will show you how to
0:05
take the screenshot of the directory of
0:08
how much files are there plus the sizes
0:11
of each file so let's suppose we have a
0:14
directory right here we want to take the
0:17
screenshot of this directory of how many
0:20
files are present inside this so I will
0:23
just write a simple Python script for
0:25
this purpose
0:27
as soon as you execute the Python script
0:30
it will
0:31
analyze it will take the screenshot of
0:34
this folder and inside a tabular
0:38
structure it will show how many files
0:41
are present in
0:45
this so let me just run this Python
0:48
script as you will see it will take the
0:51
screenshot and it will save this as a
0:53
PNG file if I try to see this you will
0:56
see it will list out all the files which
0:59
are present in the directory it will
1:03
save it as a image
1:05
file we have different files
1:13
here so you can see
1:16
that it is also showing the size of each
1:20
file in megabytes as you can see
1:24
so if you want to take the screenshot
1:27
of the directory of how many files are
1:30
present just modify
1:45
it so we are just asking this script
1:49
from chat GPT and it is giving me the
1:51
modify script here which will also
1:53
include the folders names as
1:55
well as well as the file names it will
1:58
also include the folders as well which
2:02
is given
2:05
inside so with this modification the
2:08
folder name will also be
2:10
present so let me just execute this
2:13
updated script
2:19
and I paste and if I run this Python
2:22
script so what you will see again it
2:25
will create
2:27
this and you will see this time it will
2:30
also
2:31
include the folder name as
2:34
well it will say it's a
2:38
directory so this will actually take the
2:41
screenshot of this
2:43
directory to analyze how many files are
2:46
present so in a tabular
2:51
structure so you can see that so in this
2:57
way you can adjust this if you want to
3:00
show the size in
3:01
kilobyte instead of megabyte so what you
3:05
can do I want to show size in
3:12
kilobyte so just ask this and chat gpt
3:15
based upon that will modify the script
3:18
which will actually now show the size in
3:26
kilobyte so in this easy way you can use
3:29
chat
3:31
gpt so I have given this script this
3:35
modified script in the description of
3:37
the video you can go to my website and
3:40
copy paste the script if you run this
3:46
now and now if you see the sizes will be
3:50
in kilobyte if you see
3:59
so in this way uh now let me show you
4:02
the output script here we for this we
4:04
are using a very special package which
4:07
is called as mattplot
4:11
lip which is a very important
4:15
package inside
4:22
python so we are using this package
4:25
mattplot
4:27
lip and then we are passing this collect
4:30
files for sizes we are passing the
4:33
directory name then the items list and
4:37
then defining the empty array right here
4:39
inside try we are scanning this
4:41
directory for each file we are checking
4:44
if it's a file or not then we are
4:46
calculating the size in kilobyte
4:48
appending this inside this table then we
4:51
are showing this table using the append
4:53
method and then we are saving this file
4:56
list as an image
4:58
file for saving this as an image file we
5:01
using
5:03
the image max plot
5:07
library you can see
5:09
that so thank you very much for watching
5:12
this video
5:14
i was using this package here mattplot
5:20
lip it's a very famous package here
5:23
command is
5:25
simple so also check out my website
5:28
freemediatools.com
5:30
uh which contains thousands of tools