Visit Our UNIX and Linux User Community


SFTP from remote server


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users SFTP from remote server
# 1  
Old 10-18-2015
SFTP from remote server

Hi All,While sftp from remote server an error (/) is coming before the file in a script.Please find the below log. The file is on home directory on remote server.
Code:
[sftp> get datafile_18OCT2015_* /apps/trav/home/File "/datafile_18OCT2015_*" not found.+ RC=1]


Last edited by Don Cragun; 10-18-2015 at 06:27 PM.. Reason: Add CODE tags.
# 2  
Old 10-18-2015
The error msg doesn't seem to indicate it's operating on "home" directory, but rather on the root dir. What's the output of the pwd Display remote working directory. command?
# 3  
Old 10-18-2015
From command prompt it is working fine, but from script it is throwing error as
Code:
/datafile_18OCT2015_*  not found.sftp> pwdRemote working directory: /sftp> ls


Last edited by Don Cragun; 10-18-2015 at 06:28 PM.. Reason: Add CODE tags.
# 4  
Old 10-18-2015
Please use code tags as required by forum rules!

Looks like the working directory is / . (would be clearer had you used tags!) Is there a file "datafile_..." in / ?
# 5  
Old 10-18-2015
Yes found the issue with case sensitivity. 18OCT2015

I am using the code to get the date month and year
Code:
TS=`date +%d%b%Y | tr '[a-z]' '[A-Z]' `

Can you please help me how to get data as 18Oct2015

Last edited by Don Cragun; 10-18-2015 at 06:29 PM.. Reason: Add ICODE tags.
# 6  
Old 10-18-2015
Don't pipe through tr. "Oct" is the normal date output; above tr converts every char to upper.
# 7  
Old 10-18-2015
Thanks got it...

Previous Thread | Next Thread
Test Your Knowledge in Computers #130
Difficulty: Easy
The original Unix code was developed by AT&T.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with moving files on remote server using sftp

I need to sftp a file ABC_sysdate.csv (File name with system date and timestamp) to a temporary directory on the remote server and once the file is copied I've to move the file from temporary directory to the main directory with the same name. I have to generate a new file every hour and repeat... (6 Replies)
Discussion started by: srinup
6 Replies

2. Solaris

Script to get files from remote server to local server through sftp without prompting for password

Hi, I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script. Can anyone help me in automating the script such that it... (3 Replies)
Discussion started by: ssk250
3 Replies

3. Shell Programming and Scripting

SFTP problem......File not getting from Remote server

Hi, We are using one unix script which is using sftp command and connect to remote server and get some file form remote server. some time after running this script we are not getting any file . Could you please tell us detailed validation that is there any problem with... (6 Replies)
Discussion started by: maheshkumar93@g
6 Replies

4. UNIX for Dummies Questions & Answers

Get filelist.txt from a sftp remote server

Hi everyone, so I have a script create a login file to log into the sftp remote server, go to a certain directory and get the list of files in that direction into a text file in another folder (local folder). Here is the piece of code echo "#!/usr/local/bin/expect -f" >>... (5 Replies)
Discussion started by: warmboy610
5 Replies

5. Shell Programming and Scripting

SFTP - Get size of file on remote server

Hi, I have a requirement where I need to do SFTP connection to remote server, get the size of the file on remote server and depending on the size, i need to get the file onto local server. Is there any command in SFTP to get the size of the file. I found one in FTP but not in SFTP (2 Replies)
Discussion started by: forums123456
2 Replies

6. Shell Programming and Scripting

Using SFTP and FTP to transfer data from One Remote Server To Another

HI I need to write a script in 415univ server which should go to 534unix server and move the files from there to windows server. I am not able to get it bcoz sftp prompt is not allowing ftp command. Can some one plz help me Thanks in advance (3 Replies)
Discussion started by: himakiran9
3 Replies

7. Programming

SFTP from one remote server to another remote server from desktop

Hi, I have 1. lappy 2. server A 3. server B Now, what i need is to run a command from lappy that will sftp a file from server A to server B. Please guide me to achieve this. -akash (1 Reply)
Discussion started by: akash.mahakode
1 Replies

8. Shell Programming and Scripting

Checking the file in remote server using SFTP

Hello, I would appreciate if any one can help me on this. The below script start running at 12:30AM. Every 5 min, i go and check the remote site. If i see filewatch.txt over there, then i need to call another shell script and load the data into database. If i don't see that file, then i have to... (2 Replies)
Discussion started by: govindts
2 Replies

9. Shell Programming and Scripting

SFTP setting with a remote server - need help

Hi All, i want to setup a STPF setting to a remote server. Could you please help on this. The setting i have done but its still asking for password. Could anyone throw some light on the same? Thanks in advance. Pankaj (1 Reply)
Discussion started by: panknil
1 Replies

10. Shell Programming and Scripting

SFTP:error while creating folders on remote server

Hi, I am trying to create some folders on remote server with SFTP connection. if the folder is exist then it is not executing the next commands. i.e. if temp/folder is exist then it it not executing mkdir $folder1 mkdir $folder2 commands. here is my code. sftp -b /dev/fd/0 ... (0 Replies)
Discussion started by: vgs
0 Replies

Featured Tech Videos