Quick Index
Working With Directories


What Is A Directory?


A computer directory (folder) contains computer files and may contain sub-directories. Directories form a tree on your computer system.

Directories In File Browser


Below we are showing a directories in a file browser. We are viewing the "Drill1" directory. The full path to this directory is:
 "C:\Work\Courses\Practice\Drill1"
. The browser also shows us that the "Drill1" directory has three sub-directories: Add, Multiply and Subtract



Directory Tree


The schematic figure below shows us the directory tree (for the directories shown in the previous section). It shows us the parent and sub-directory relationships.

\---Work
    \---Courses
        \---Practice
            \---Drill1
                \---Add
                \---Multiply
                \---Subtract

A few relationships from the tree above:


Adding Directories


We'll often be adding directories (folders) to organize our files.

Adding a Directory:


Directory And File References



File Browser


What Is A File Browser?


A file browser is a great tool for working with files. 👍🏽

In Microsoft Windows, the file browser tool is called the "File Explorer", and in the macOS it is the "Finder".

We'll now hit some examples using the Microsoft Windows "File Explorer". The macOS "Finder" has similar features.

Terms


The browser components:

  • Current Directory -- This is the directory we have selected and are showing in our file browser. Our current directory is "Foo" (full path is "C:\Work\Foo"). Note....
  • Directory Contents -- The sub-directories and files contained inside the current directory

Actions


1. Right-Click the mouse on the "Start" menu
2. Choose "File Explorer"

Another approach is to choose "Search" and enter a keyword like "file", "explorer", etc

Quick Demo
Here is how to navigate through the directory tree:

  • Notice the current dir (cd) is "Foo".
  • Double click on Foo's sub-directory "Campgrounds"
  • Notice the new current dir is now "Campgrounds"
  • Notice that we now see the contents of "Campgrounds"

Quick Demo
  • Make sure no files are selected in the "Directory Contents" Area
  • Right-click the mouse and choose 'New'.

A popup menu will open. We'll use these three guys a lot (click each for details):

In a file browser

  • Select the file to copy
  • Right click on selected file
  • Select "Copy" action"
In a file browser.
Note -- do this action after you have copied a file.

  • Right click away from the files (in the blank area)
  • Select the "Paste" action

 /nlist
Select a row/item
Right-click
You will see actions like those shown in the picture.

/t
Also See:
/list
#CopyFile
#PasteFile
Quick Demo, Refs/Demos/CopyPasteRenameDelete.mp4
How to copy files, https://www.computerhope.com/issues/ch000766.htm
"How to delete a file, directory, or folder", https://www.computerhope.com/issues/ch000743.htm
This is optional only -- we may also find these actions on the browser toolbar.

Reminder: There are usually multiple ways to perform an action (your choice).

Slash And Back Slash


Windows file paths use the backslash:

\Work\Foo\MyFile.txt


MAC and Unix file paths use the forward slash:

/Work/Foo/MyFile.txt


Viewing File Extensions


See Viewing File Extensions

File Browser References



Viewing File Extensions


As coders, we always need to know the file extension of the file we are working on. This page will show how to do that.

Example File Extensions
File NameFile ExtensionAlso Called
readme.txttxtTXT file
Rectangle.javajavaJAVA file
Rectangle.classclassCLASS file
Sort.pypyPY file
Show File Extensions in Windows
  • Select "View" Tab
  • Check the "File name extensions" checkbox
  • Note that we can now see file extensions such as "class, "java", etc.

Quick Demo

Show File Extensions on the MAC
On the MAC, make sure "Show all filename extensions." is selected (under Finder > Preferences/Settings -- Advanced).

See:


Working Directory


What Is A Working Directory?


The working directory is simply a computer directory where we will do our coding work for a given coding exercise/project/etc.

The working directory will contain files and possibly other sub-directories as needed.

You will likely add a new working directory each time you start a new coding project.

Here is an example "working directory" that we named "Practice1". Yours may be different of course 😉!

NOTE WELL -- It is suggested to add your working directories somewhere under the "\Work" directory tree (as shown in this example) -- to avoid the GOTCHA described in the next section.

Also see Directory...
C:\
    \---Work
           \---MyWork
                  \---Practice1

Beware Of GOTCHA!


Watch out for this GOTCHA: "read-only" areas of your computer.

For example, in Windows, you would not want to put your working directory under "Program Files".

Do not do this:

C:\
    \---Program Files
          \---Drill1


Yes do this -- Add a directory named "Work":

C:\
    \---Work


Then you can put your working directories anywhere under your "Work" directory:

C:\
    \---Work
           \---MyWork
                  \---Practice1


ZIP (Compressed) Directory


Also see ZIP File