1
00:00:05,200 --> 00:00:08,400
In this video, we're going to have a 
quick look at how files and directories 

2
00:00:08,400 --> 00:00:13,360
are stored on your computer's hard drive.
There's nothing complicated in this video. 

3
00:00:13,360 --> 00:00:17,600
If you already know about file paths, you 
may want to skip it, and the next two videos, 

4
00:00:17,600 --> 00:00:21,840
and move on to the Text files video.
I'm using a Windows computer to record 

5
00:00:21,840 --> 00:00:27,625
these videos. Most students are running 
Windows, which is why I'm using it. 

6
00:00:28,320 --> 00:00:33,760
If you're using a Mac, or a Linux computer, there 
are two main differences you need to be aware of. 

7
00:00:33,760 --> 00:00:38,640
The first is that Windows uses drive 
letters. Linux and Mac OS don't. 

8
00:00:38,640 --> 00:00:42,240
If you're not using Windows, 
you can ignore drive letters. 

9
00:00:42,240 --> 00:00:46,880
Each drive, on Mac OS or Linux, is 
mounted and appears as a directory. 

10
00:00:46,880 --> 00:00:49,578
So what are drive letters? 

11
00:00:51,360 --> 00:00:54,960
It's common to have more than one 
disk drive connected to your computer. 

12
00:00:54,960 --> 00:00:59,520
That may seem like a strange thing to say, when 
many computers only come with one disk drive, 

13
00:00:59,520 --> 00:01:04,000
but consider what happens when you plug a 
USB drive or memory stick into your computer. 

14
00:01:04,000 --> 00:01:07,200
Once your operating system 
has recognised the USB device, 

15
00:01:07,200 --> 00:01:11,280
it behaves like a separate disk drive.
On Linux or Mac OS, 

16
00:01:11,280 --> 00:01:16,289
the external device will appear as a 
folder. Windows doesn't work like that. 

17
00:01:16,289 --> 00:01:22,974
I'll fire up the Windows file manager, called File 
Explorer, to show how Windows uses drive letters. 

18
00:01:23,760 --> 00:01:30,160
Ok, this is the Windows file manager. In 
many ways, for programmers, it's hideous! 

19
00:01:30,160 --> 00:01:33,200
Microsoft have tried to make 
it as easy to use as possible, 

20
00:01:33,200 --> 00:01:38,960
for people who don't know much about computers. 
To a large extent, they've succeeded. 

21
00:01:38,960 --> 00:01:41,840
If you're still watching this video, 
then you've probably been using your 

22
00:01:41,840 --> 00:01:46,272
computer quite happily, without knowing 
about drive letters and file paths. 

23
00:01:46,272 --> 00:01:51,471
At the top of the File Explorer window, 
we have a set of Frequent Folders. 

24
00:01:52,880 --> 00:01:57,280
These are the folders that Windows has noticed 
you use most often. They include things like 

25
00:01:57,280 --> 00:02:02,800
your Downloads and Documents folders. You might 
also have your IntelliJ projects folder there. 

26
00:02:02,800 --> 00:02:07,520
As you can see, a lot of the folders I 
frequently use, on this computer, are related 

27
00:02:07,520 --> 00:02:13,520
to my Python and Java courses. My Downloads 
folder is in there, and so is my Desktop. 

28
00:02:13,520 --> 00:02:18,800
The exact contents will change, as Windows 
notices you frequently using certain folders. 

29
00:02:18,800 --> 00:02:23,520
All of this is intended to shield people from 
having to understand file paths. You put your 

30
00:02:23,520 --> 00:02:29,267
documents in Documents. What could be simpler?
But we're no longer average users. 

31
00:02:29,267 --> 00:02:33,599
We need to understand what's really happening, 
and where these directories really are. 

32
00:02:33,599 --> 00:02:38,400
If you're not using Windows, keep watching. 
Windows is still the most popular operating 

33
00:02:38,400 --> 00:02:43,075
system out there, and you will want to make 
sure that your code runs correctly on Windows. 

34
00:02:43,280 --> 00:02:46,960
Over on the left, we have a list 
of the directories on my computer. 

35
00:02:46,960 --> 00:02:52,000
Once again, that's been simplified. The 
first section is labelled Quick access, 

36
00:02:52,000 --> 00:02:55,979
and contains the same directories as 
the Frequent folders list on the right. 

37
00:02:56,080 --> 00:03:00,560
Where it gets interesting, is when we view 
the real directory structure. Scrolling down 

38
00:03:00,560 --> 00:03:05,920
through the This PC list, on the left, we can 
see the disk drives connected to my computer. 

39
00:03:05,920 --> 00:03:09,718
The first entry we're interested 
in is the Local Disk C. 

40
00:03:10,640 --> 00:03:14,880
Drive C is the default drive on Windows 
computers. That's where Windows itself 

41
00:03:14,880 --> 00:03:19,040
is normally installed, and also where 
all your files will probably end up. 

42
00:03:19,040 --> 00:03:23,040
The reason why it's "C", rather 
than "A", is because drives "A" 

43
00:03:23,040 --> 00:03:26,400
and "B" are reserved for removable floppy disks. 

44
00:03:26,400 --> 00:03:30,640
Floppy disks aren't used these days, 
but in the days before hard disk drives, 

45
00:03:30,640 --> 00:03:36,640
we used to store our files on removable disks, 
that could store up to 1.4 megabytes of data. 

46
00:03:36,640 --> 00:03:42,480
Yes, you heard that right. 1.4 megabytes 
was considered a lot of storage back then! 

47
00:03:42,480 --> 00:03:45,520
A selfie taken on a modern mobile 
phone could be bigger than that, 

48
00:03:45,520 --> 00:03:49,534
but 30 years ago, one megabyte was large! 

49
00:03:50,320 --> 00:03:54,080
Ok, that's why the first 
hard drive is called Drive C. 

50
00:03:54,080 --> 00:03:59,920
On your computer, that may be the only drive 
shown. On my computer, I also have a Drive Y, 

51
00:03:59,920 --> 00:04:02,640
and a few network drives.
So on Windows, 

52
00:04:02,640 --> 00:04:08,560
each disk drive is given a drive letter.
On Mac OS or Linux, drive letters aren't used. 

53
00:04:08,560 --> 00:04:13,842
That's the first difference between paths on 
those operating systems, and paths on Windows. 

54
00:04:13,842 --> 00:04:17,440
I'll come to the second difference, 
when we look at file paths. 

55
00:04:17,440 --> 00:04:22,339
Let's have a look at what's on my Drive Y.
You probably won't have a Drive Y on your computer. 

56
00:04:22,339 --> 00:04:26,917
Don't worry, this is one of those videos 
where you won't be following along at first. 

57
00:04:26,917 --> 00:04:32,160
Just watch, and make notes about what I'm explaining.
I've only got one directory on that drive, 

58
00:04:32,160 --> 00:04:35,600
a directory called 
current-python-masterclass-remaster. 

59
00:04:35,600 --> 00:04:39,389
That's where I store all the projects for 
the remastered sections of this course. 

60
00:04:39,520 --> 00:04:44,400
Your projects will probably be on drive 
C, in a directory called IdeaProjects. 

61
00:04:44,400 --> 00:04:47,840
If you've put them somewhere else, 
then you'll know where to find them. 

62
00:04:47,840 --> 00:04:53,360
I've also got a file, called dot DS_Store. 
Note the different icons that Windows uses 

63
00:04:53,360 --> 00:04:59,040
for directories and files. The Mac and Linux 
file managers also use different icons. 

64
00:04:59,040 --> 00:05:03,280
Directories are represented by a folder 
icon. Files have different icons, 

65
00:05:03,280 --> 00:05:06,800
depending on what the file contains.
On my screen, 

66
00:05:06,800 --> 00:05:11,788
the current-python-masterclass-remaster 
directory is represented by a yellow folder icon. 

67
00:05:11,788 --> 00:05:16,160
The dot DS_Store file is represented 
by an icon that represents a sheet of paper, 

68
00:05:16,160 --> 00:05:21,884
with one corner turned down. That's 
become a universal icon for a document. 

69
00:05:22,560 --> 00:05:25,600
What's the difference between 
a file and a directory? 

70
00:05:25,600 --> 00:05:29,120
All the information you save on 
your computer is stored in files. 

71
00:05:29,120 --> 00:05:34,339
We've created a lot of Python files throughout 
this course, and each one contained Python code. 

72
00:05:34,560 --> 00:05:37,516
So you've already seen that 
you can store text in files. 

73
00:05:37,680 --> 00:05:42,640
Files can also contain images, or music.
If you've used a spreadsheet program, 

74
00:05:42,640 --> 00:05:47,588
or word processor, your documents 
are also stored in files. 

75
00:05:49,280 --> 00:05:54,399
Files are stored in directories.
So a directory is just a container for files. 

76
00:05:54,480 --> 00:05:58,640
Think of a directory as the digital 
equivalent of folders in a filing cabinet. 

77
00:05:58,640 --> 00:06:04,080
In fact, directories are also called folders. 
I'll use both terms, so you get used to the 

78
00:06:04,080 --> 00:06:09,520
fact that they mean the same thing.
Back in the Windows file manager, 

79
00:06:09,520 --> 00:06:14,548
I'll double-click that directory, to open 
it up and have a look at what it contains. 

80
00:06:15,680 --> 00:06:19,680
Inside, I've got folders for each 
of the Projects for the course. 

81
00:06:19,680 --> 00:06:26,480
There's DictAndSet, Functions_Intro, and so on.
Folders can contain other folders. They're used 

82
00:06:26,480 --> 00:06:31,040
to organise the files on your hard drive, 
so that you can find things more easily. 

83
00:06:31,040 --> 00:06:35,520
They also prevent the files from one application 
interfering with the files from another. 

84
00:06:35,520 --> 00:06:39,360
We can see an example of that. I'll 
double-click Functions_Intro and we 

85
00:06:39,360 --> 00:06:47,035
can see the __pycache__ directory, at the top.
That holds the compiled Python code for this project.

86
00:06:47,035 --> 00:06:50,000
Each project will 
have its own pycache folder. 

87
00:06:50,000 --> 00:06:56,320
I'll go back one level, and open the Sequences 
directory. That also has a pycache folder. 

88
00:06:56,320 --> 00:06:58,560
If projects weren't stored in their own folders, 

89
00:06:58,560 --> 00:07:04,000
one project might change the compiled files for 
a different project, and things could get messy. 

90
00:07:04,000 --> 00:07:08,640
Directories, or folders, are used to 
organise the files on the hard drive. 

91
00:07:08,640 --> 00:07:13,520
As you'll have noticed, IntelliJ creates 
a new directory for each new project. 

92
00:07:13,520 --> 00:07:17,200
That keeps the files for each project 
together, which is much tidier than having 

93
00:07:17,200 --> 00:07:24,000
hundreds of Python files in the same folder.
Ok, that's a quick look at files and directories. 

94
00:07:24,000 --> 00:07:27,680
Before we move on, there are a couple 
of settings you should know about. 

95
00:07:27,680 --> 00:07:30,800
The first one is one I 
definitely recommend you turn on. 

96
00:07:30,800 --> 00:07:35,680
Open the View menu in the Windows file explorer, 
and have a look at the options over on the right. 

97
00:07:35,680 --> 00:07:41,360
The one I recommend you tick is File 
name extensions. For quite a while, 

98
00:07:41,360 --> 00:07:45,826
that option was disabled by default.
If it's unticked, File Explorer doesn't 

99
00:07:45,826 --> 00:07:49,760
show the file extensions for a lot 
of the file types that it recognises. 

100
00:07:49,760 --> 00:07:53,582
That can be confusing, so 
make sure you tick that box. 

101
00:07:54,720 --> 00:07:58,480
Mac OS has a similar option, 
in the Finder preferences. 

102
00:07:58,480 --> 00:08:01,760
Have a look on the Advanced 
tab, if you want to change it. 

103
00:08:01,760 --> 00:08:06,720
Linux doesn't have an equivalent option. 
File extensions aren't hidden on Linux. 

104
00:08:06,720 --> 00:08:10,800
File extensions are used by Windows 
to identify the file's contents. 

105
00:08:10,800 --> 00:08:16,640
For example, a jpeg image will be stored 
in a file with the extension .jpg or .jpeg. 

106
00:08:16,640 --> 00:08:19,680
Text files are usually stored in .txt files. 

107
00:08:19,680 --> 00:08:24,432
And we've been using the extension 
.py for our Python source code files. 

108
00:08:25,520 --> 00:08:28,402
The other option you should 
know about is Hidden items. 

109
00:08:28,402 --> 00:08:32,640
I've got that ticked, which means hidden 
items are showing in the File Explorer. 

110
00:08:32,640 --> 00:08:35,760
The default is unticked.
Most of the time, 

111
00:08:35,760 --> 00:08:41,655
you probably don't want to see hidden files. If 
you can't see them, you can't accidentally delete them – 

112
00:08:41,655 --> 00:08:45,840
that's one reason why they're hidden.
They're also of no interest to ordinary users, 

113
00:08:45,840 --> 00:08:50,539
so they're hidden to avoid cluttering the display 
with files that most people aren't interested in. 

114
00:08:50,640 --> 00:08:55,212
As programmers, we will sometimes need to 
view those hidden files and directories. 

115
00:08:55,280 --> 00:08:59,158
So now you know how to reveal 
them – just tick that box. 

116
00:09:00,160 --> 00:09:05,200
The Finder in Mac OS, and Linux file managers 
such as Nautilus, also have options to hide 

117
00:09:05,200 --> 00:09:11,760
certain files. On those operating systems, hidden 
files have names that start with a dot, or period. 

118
00:09:11,760 --> 00:09:16,406
Configuration files for programs are often 
stored in a folder whose name starts with a dot, 

119
00:09:16,406 --> 00:09:18,880
and you may need to examine those folders. 

120
00:09:18,880 --> 00:09:23,429
If you're using a Mac, you can show hidden 
files in Finder with Cmd-Shift-Period. 

121
00:09:23,429 --> 00:09:27,760
That toggles hidden files on or off, for 
the current directory you're displaying. 

122
00:09:27,760 --> 00:09:32,704
On Linux, Nautilus uses 
Ctrl-H to show hidden files. 

123
00:09:34,400 --> 00:09:38,880
Use your operating system's file manager 
– Windows Explorer, Mac's Finder, 

124
00:09:38,880 --> 00:09:42,960
or Nautilus on Ubuntu – to browse through 
the directories on your hard drive, 

125
00:09:42,960 --> 00:09:48,960
and get a feel for how directories (or folders) 
can contain files, and other directories. 

126
00:09:48,960 --> 00:09:55,157
Don't move or delete anything, just spend a bit 
of time examining the contents of your hard drive. 

127
00:09:56,480 --> 00:09:59,280
You should be able to find 
your home folder. Its name 

128
00:09:59,280 --> 00:10:02,800
will usually be the same as the name 
you use to log into your computer. 

129
00:10:02,800 --> 00:10:06,800
On Windows, it will normally be 
on Drive C in the Users directory. 

130
00:10:06,800 --> 00:10:11,760
But it could be on a different drive, if your 
computer was set up with additional disk drives. 

131
00:10:11,760 --> 00:10:18,080
On a Mac, your home folder is also in Users.
On Linux, look for /home. Your home folder 

132
00:10:18,080 --> 00:10:20,983
should be in there.
Inside your home folder, 

133
00:10:20,983 --> 00:10:24,080
you should find the directories where 
your operating system defaults to storing 

134
00:10:24,080 --> 00:10:29,600
your documents, pictures, videos and so on.
In the next video, we'll have a quick look 

135
00:10:29,600 --> 00:10:38,480
at the command prompt (on Windows) and terminal 
(on Mac OS and Linux). See you in the next video.

