Topic "Cannot download using sftp"

Author Message
roshan
[View user's profile]

Joined: 2013-03-23
Posts: 3
Hi:

I want to download file automatically.I saved this script in .txt file and call the .txt file in command prompt:-

# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off

# Connect
open "CDN" -hostkey="ssh-rsa 1024 fe:8f:d9:c0:5b:a4:f8:bf:91:4f:80:41:36:7b:38:87"
# Change remote directory
cd /home/user
# Force binary mode transfer
option transfer binary
# Download file to the local directory d:\
get test.txt c:\
# Disconnect
close
# Exit WinSCP
exit

I can see that it is connecting but it doesnt copy file to c:\.Any idea where is the problem
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
Please attach a full log file showing the problem (using the latest version of WinSCP).

To generate log file, use /log=path_to_log_file command-line argument. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you may email it to me. You will find my address (if you log in) in my forum profile. Please include link back to this topic in your email. Also note in this topic that you have emailed the log.

_________________
Martin Prikryl
roshan
[View user's profile]

Joined: 2013-03-23
Posts: 3
Hi :

I fixed it. But when i run the command it copies folder and subfolders.How can i just copy the file and not folder and subfolder structure. .The command is below:-

get -filemask=FULL_us_chhc_*2013*.txt /pc/user1/backup/backup/backup/* c:\

Regards,
Roshan
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
roshan wrote:
How can i just copy the file and not folder and subfolder structure.

You cannot.
_________________
Martin Prikryl
Guest




ok.Is there any way i can copy the file if it exists in any subfolder.What i am trying to do is user will enter file name and it needs to be copied to local server .The file can reside in any folder/subfolder
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24530
Location: Prague, Czechia
get -filemask="filename; */" /remote_path/* c:\local_path\

http://winscp.net/eng/docs/scriptcommand_get
http://winscp.net/eng/docs/file_mask
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License