Moving and copying files

Opening files

In the Files tab, clicking a file name or icon opens the file. The behaviour depends on the file type:

  • SQL files open in an SQL editor page where you can write, modify, run, and save SQL. These files can be saved as a custom view: see creating a custom view for more information.
  • Text files open in a text editor which allows you to edit and save the file.
  • Image files open the image.

Moving or copying files

You can copy or move files either using R console, the Virtual Desktop or the ‘Save as’ button located in the Files tab.

If you want to quickly copy a single file to the Files folder or the current location, the most convenient way is to use ‘Save as’ button, which can be found in the right-hand sidebar.

If you want to move multiple files, it might be more convenient to use R console or Virtual Desktop.

Moving or copying files using Virtual Desktop

Moving or copying files using the Virtual Desktop is probably the most simple way since the Virtual Desktop has a shared file system with the workspace. Therefore, you can copy, edit, rename and move your workspace folders and files just like you would on your computer, and the changes will be reflected in the workspace file system.

In a Linux machine, the workspace files can be found at /home/desktop/files/. In a Windows machine, the files can be accessed by clicking This PC, and then navigating to the files folder.

Moving or copying files using R console

To move or copy the workspace files in the R console, you will need to use some of the following commands:

  • Get the absolute path of the working directory: getwd()
  • Change the working directory: setwd('files')
  • List the files in the current directory: list.files():
    • To list the contents of a specific folder, add a path parameter, and specify the path to the folder: list.files(path='./name_of_folder')
    • To also list the contents of the folders, add a recursive parameter and set it to TRUE: list.files(recursive=TRUE)
  • Create a new folder in the current directory: dir.create('new_folder')
  • Copy a file: file.copy('file_name.txt', ‘path_to_destination_folder’)
  • Move a file: file.rename('file_name.txt', ‘path_to_destination_folder’)
  • Delete a file: file.remove('file_name.txt')

Updated on April 29, 2021

Was this article helpful?

Related Articles

Not the solution you were looking for?
Click the link below to submit a support ticket
CONTACT SERVICE DESK