Transfer LabKey Files from the Command Line

 

The command-line tool ‘wget’ can be used to transfer LabKey files (one at a time) via a command line on any Unix System.

 File Download Instructions

  1. Log into LabKey

  2. Navigate to the file repository that contains the file you wish to transfer and click the Repository Title.

  3. Copy the WebDAV URL For the folder with the files you want to transfer.

  4. Navigate to your command line and enter the following code to download the file via the wget command line (substituting the path to your @files folder):

    wget --user=[LABKEY_USER_ACCOUNT_EMAIL] --ask-password https://www.labkey.org/_webdav/ClientProject/File%20Share/%40files/dataset.xls

  5. You will be prompted to provide your LabKey password.

  6. The file will be downloaded to your computer in the location you were in when you ran the command. If necessary, update your location in the command line prior to running the file download command.

 File Upload Instructions

  1. Navigate to the LabKey file repository that the file you wish to transfer is located in and click the Repository Title.

  2. Copy the WebDAV URL For the folder with the files you want to transfer.

  3. Navigate to your command line and run the following command to upload files on your local machine to a file repository in LabKey. Remember to update the command template to the correct file paths:

    wget --method=PUT --body-file=/Users/johnsmith/dataset.xls --user=[johnsmith's email address] --ask-password https://www.labkey.org/_webdav/ClientProject/File%20Share/%40files/dataset.xls -O - -nv
  4. You will be prompted to provide your LabKey password

  5. The file will be uploaded straight to the designated file repository on LabKey. You must be authorized to add files to the repository in order for this command to work.

For further information, please see here: https://www.labkey.org/Documentation/wiki-page.view?name=fileSharing#wget