Upload files using SFTP or SCP commands (2024)

  1. Last updated
  2. Save as PDF

Learn how to upload files using SFTP or SCP commands.

Upload a file using SFTP or SCP commands

Use the SFTP or SCP client of your choice. Click "Enter/Return" on your keyboard after each command.

Note: Commands are case-sensitive and all alphabetic characters must be lowercase.

Method Commands
SFTP
  1. Using your institution's assigned username, enter the following command:sftp [username]@[data center]
  2. Enter your institution's assigned password
  3. Choose directory (see directory folders): Enter cd [directory name or path]
  4. Enter put [myfile] (copies file from your local system to OCLC's system)
  5. Enter quit
Secure Copy
  1. Enter scp [myfile] [username]@[data center]:[directory name or path] (see directory folders)
  2. Enter the password when prompted

Verify a file has been uploaded successfully

Almost immediately after a file upload completes, the system moves the file into a queue for subsequent processing and it is no longer available on the upload server. The only reliable way to verify the success of the upload is to check for a non-zero condition code or for error messages after the upload attempt.

The following is an example of a script that checks for a non-zero return code.This assumes the bash shell is in use, which is the default on most Linux distributions:

#!/bin/bash# This script assumes that a public / private key pair has been setup already between the# client account that is running the script on the local machine and the fx_zzzzz server# account on OCLC's filex-m1.oclc.org hostsftp -v fx_zzzzz@filex-m1.oclc.org <<EOFlcd /zzzzz/bib/xfer/out/cd /xfer/metacoll/in/bib/put 1234567.zzzzz.bibs.20200101.mrcquitEOF# Best practice is to assign the sftp return code to a variable for further use, because# ${?} is fleeting and only shows the condition code of the immediately preceding commandSFTP_RETURN_CODE=${?}# If the return code is non-zero then the upload was not successfulif [[ 0 != ${SFTP_RETURN_CODE} ]] then echo "bib upload for zzzzz failed" exit ${SFTP_RETURN_CODE}else echo "bib upload for zzzzz was successful"fiexit 0
Upload files using SFTP or SCP commands (2024)
Top Articles
Latest Posts
Article information

Author: The Hon. Margery Christiansen

Last Updated:

Views: 6251

Rating: 5 / 5 (70 voted)

Reviews: 85% of readers found this page helpful

Author information

Name: The Hon. Margery Christiansen

Birthday: 2000-07-07

Address: 5050 Breitenberg Knoll, New Robert, MI 45409

Phone: +2556892639372

Job: Investor Mining Engineer

Hobby: Sketching, Cosplaying, Glassblowing, Genealogy, Crocheting, Archery, Skateboarding

Introduction: My name is The Hon. Margery Christiansen, I am a bright, adorable, precious, inexpensive, gorgeous, comfortable, happy person who loves writing and wants to share my knowledge and understanding with you.