File management in this course

1 Simplest ways to obtain the teaching materials

  • Web \(\rightarrow\) Your PC \(\rightarrow\) Jupyterlab RStudio

  • All on the cloud

You will need some teaching materials to open in your RStudio. Here you will get tips how to manage files fully interactively, without using a single line of code.

If you can manage files in the unix command line, use Git, or manage files programmatically with R, feel free to skip this tutorial and make use of your superpowers.

2 File explorer in RStudio’s bottom right pane

Four panes in RStudio

All around interactive file management happens in the bottom right RStudio pane, the Files tab.

3 Your RStudio \(\approx\) Your Home Directory

  • Jupyterlab runs on OS Linux.

  • Each user was given a home directory to

    • read files

    • write (create or edit) files

    • execute program files.

  • You can see the entire file structure, but only read or write those folders that the IT admin or their owner made available to you.

  • Do not delete the bin and R folders.

Your Home directory

This tutorial will guide you through the folder structure later. For this moment, let us pretend that you are the only user of this RStudio installation or even on the entire server.

4 Upload from your computer to Jupyterlab RStudio

You can upload files to the cloud from your local computer. Use the Upload button. The upper field in the dialog box navigates you through the file system on Jupyterlab. The Browse… button will take you to your local file system.

One File at a time

You can only upload one file at a time. If you need to upload several files or a folder, you have to pack them into a .zip file. Jupyterlab RStudio will automatically unzip it.

5 Download from Jupyterlab RStudio to your computer

Interactive Download from Jupyterlab RStudio

Check the file(s) on Jupyterlab in the explorer. Hit the More menu (the one with the gear icon) and select Export.... If you have selected more than one file, RStudio will export the batch as a zip file.

6 Move and Copy files in your RStudio

You want to copy a file into a folder in RStudio.

Copy a file into a folder in RStudio

You can as well save it under a different name.

8 Read other students’ RStudio folders

  • Students and teachers can read each others’ folders and copy from them.

  • Details at the end of this presentation.

To copy files from others, you need to be familiar with the file system and how it works. Maybe you will not need it at all, so I will postpone this topic to the very end of this tutorial.

9 Download teaching materials from GitHub

  • GitHub ≈ GoogleDrive for programmers

    • Files and folders in a dedicated repository

    • powered by a tool called Git

      • change tracking, sharing management

      • complex programmatic commands

  • Without Git: Download a repository or file to your PC

    • you only get the current snapshot

    • Go to the repository URL

    • use GitHub’s web GUI

Should symlink not be available for you, download the teaching materials from GitHub.

I store all my teaching materials in a GitHub repository for backup and access from different computers. You can download everything from there without bothering about the Git commands. But note that this ordinary download is but a snapshot and will not reflect future changes in the original.

10 GitHub Download Button

  • Hit the Code Button and Select Download ZIP

  • Each file has its own URL (click on it to get there)

  • You can also download the entire repo

Download from GitHub
  1. Go to the GitHub repository page (you’ll usually get a link).

  2. Find the file or folder you want.

  3. Click on the file name to open it.

  4. Click the “Download” button (usually a small icon or you can right-click and choose “Save As”).

    • If you want the entire repository, click the green “Code” button near the top right, then choose “Download ZIP”.

11 Download a folder from GitHub

  • GitHub GUI Download works only for a file or a repository.

  • Use this web service to download a folder:

https://download-directory.github.io/?url=https://github.com/

THE_NAME_OF_THE_REPO/tree/main/THE_NAME_OF_THE_FOLDER

Fortunately for us, there is a web service named download-directory.github.io and you can use it simply by opening your browser and typing in a URL containing its name and the path to the target folder.

Caveat!
  • The URL of each GitHub repository ends with a suffix .git . Do not include this suffix.

  • GitHub imposes some additional structure on the folders. Include /tree/ after the repository name, followed by another internal “folder name”. This would typically be main. main is the default name given by GitHub, but the repository owner could have renamed it.

12 Download folders with download-directory.github.io

External web service download-directory.github.io

13 UFAL Linux Network

  • must-know if you

    • want to copy directly from teacher’s or students’ folders

    • get lost by inadvertently clicking on something in the Files tab.

  • / is the top of the file system. The home folder contains home folders of all users.

Your home is inside here.

Your home is inside here.

Do not make this a big deal because you will probably not use Jupyterlab RStudio in your personal work setup. But you could benefit from a basic orientation in the system during this course.

Jupyterlab is installed on a computational grid called AIC (Artificial Intelligence Cluster).

14 Alternative paths to your home

Your home as /home/YOURLOGIN

Path to your home as /lnet/aic/personal/YOURLOGIN

Do not ponder on it. It’s how the IT admin organized the file system.

15 Copy from someone’s home to yours - Step 1

Navigate upwards in the file structure to /home/ YOUR_COLLEAGUE’S_FOLDER

16 Copy from someone’s home to yours - Step 2

Select the item to copy (one file) and activate the menu

17 Copy from someone’s home to yours - Step 3

Select the target folder (probably your home). To select a subfolder, type ~/FOLDER_NAME.

18 Copy from someone’s home to yours - Step 4

  • Note that you are still in your colleague’s folder.

  • The file went ahead of you!

... Or select a subfolder interactively

19 Copy from someone’s home to yours - Step 5

Navigate home!

20 Copy from someone’s home to yours - Step 6

Mission accomplished!

21 Copy someone’s folder to your home

When you copy a folder, you must give the copy a name before saving.

Folder copy in your home, renamed