Even if you are only transferring one file, it is a good idea to go ahead and use the following scripts in order to lower the barrier to automation in the future.
The script below is a Windows™ batch script which will change to the proper directory and call PuTTY’s PSCP command to copy all CSV ﬁles in the directory to the remote server. Simply copy and paste the text below into a ﬁle called
pharos360_data_transfer.bat and replace the portions in capital letters with the proper directory names and username supplied to you by Pharos Resources. Lines beginning with
rem are comments and will be ignored. Since the script is usually run by the system a speciﬁc time every day, the
-batch ﬂag tells it not to prompt for input; this will ensure that the script will simply exit if there are any errors when executing (you should remove this option the ﬁrst few times you attempt to transfer the ﬁles, otherwise you will not see any errors). Finally, the
-i ﬂag tells the script to look for the private key at the speciﬁed location.
Please note that the first time you connect you will be prompted to cache our server's fingerprint on your machine. The -batch flag will prevent you from seeing this prompt
rem This program copies the necessary files to the Pharos 360 application rem rem The pscp command below has the following format: rem rem pscp -batch -i key_file local_files_to_copy.csv firstname.lastname@example.org:directory_to_store_files cd C:\MY\PHAROS360\DATAFILES\DIRECTORY pscp -batch -i C:\PATH\TO\MY\PRIVATE_KEY.ppk *.csv UNIV_CODE@UNIV_CODE-uploads.pharos360.com:uploads/
- Login to the machine as the user that will be sending the ﬁles
- Use the
cdcommand to change to the directory containing the data ﬁles to be uploaded
- Use the following command to copy the ﬁles to our server:
scp -i /path/to/your/key/.ssh/id_rsa *.csv