Topic "Winscp- want ot upload multiple files"

Author Message
gnanasundram
[View user's profile]

Joined: 2012-02-27
Posts: 3
Location: Hyderabad
Hi,

I am using winscp.exe to upload the file to server, but i am face some problem while uploading the files.
If i send a file by using the command PUT abc.txt then the file is uploaded successfully.
But i want to upload multiple file so i used below command.

PUT *.csv or PUT *.* command it says the file not found.

Can you please suggest on this and give a solution the error.

Thanks in advance

Regards,
Gnansundram
Advertisements
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
What is the actual problem?
1) There are files macthing the mask and WinSCP does not find them
2) There are indeed no files macthing the mask and you want WinSCP to silently do nothing
Also what version of WinSCP are you using?
_________________
Martin Prikryl
gnanasundram
[View user's profile]

Joined: 2012-02-27
Posts: 3
Location: Hyderabad
Hi,

Thanks for your reponse.
I want to upload a file to server using SFTP and for that i use winscp.exe.(using GUI working fine) winscp version 3.7.1
now i want to automate the file transfer.
I tried the below script for automation:
Batch file
start "D:\new test\" winscp.exe /console /script=sample.txt"

Sample.txt

open username:password@ipaddress:10022
option batch on
option confirm off
cd /filename
put "Z:\*.csv"
now when iclick on bat file it connect to server and get stoped in the put command and shows an error file not found,but when i give file put filename.csv then the file get uploded.
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
Your SAMPLE.TXT script seems flawed.

Try this:
Sample.txt
# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Force binary mode transfer
option transfer binary
# Establish the connection
open username:password@ipaddress:10022
# Change the Local Directory
lcd "Z:\"
# Change to the correct Remote directory
cd /<RemoteDirectory>
# List the local files
lls
# List Remote Files
ls
# Upload *.csv
put "*.csv"

This will give you a list of the Local Directory and the Remote Directory so you can be sure you're looking at the correct locations.

I'm assuming that Z: refers to a mapped network drive? Pls be aware that this won't be available if you're planning on running this script as a scheduled task, unless you map it manually in the tasks batch file.

You're better off using this command to be universally accessible:
# Change the Local Directory
lcd "\\servername\share"


Hope this helps.
Tim
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
gnanasundram wrote:
[...]i use winscp.exe.(using GUI working fine) winscp version 3.7.1[...]

Shocked Shocked Shocked Shocked

Consider using a newer version. 4.3.7 stable or 5.0.5 beta
Guest




Hi,
Thanks for sample script,but i am getting the same error.
i followed the same step which you have given.but i am getiing the below error
winscp>put *.CSV
*.csv 0kb 0.0kb/s binary 0%
file or folder '*.csv' does not exit
but when i give filename.csv transfer successfull shows below message.
winscp>put filename.csv
filename 0kb 0.1kb/s binary : 100%


but i want to transfer multiple file at a time.

Thanks and Regards,
Gnanasundram
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
Can you paste the output of both of these commands please?

# List the local files
lls
# List Remote Files
ls

Tim
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
3.7.1 does not support file masks in scripting commands. Please upgrade to the latest version.
_________________
Martin Prikryl
Guest




prikryl wrote:
3.7.1 does not support file masks in scripting commands. Please upgrade to the latest version.

Hi,
Thanks for your response,
I have installed winscp(version 4.3.3) in my machince but i dont know how to run winscp in command mode
Can you please suggest me how to write a bat file which runs winscp in command mode.

Thanks and Regards,
Gnanasundram
gnanasundram
[View user's profile]

Joined: 2012-02-27
Posts: 3
Location: Hyderabad
[quote="Anonymous"]
prikryl wrote:
3.7.1 does not support file masks in scripting commands. Please upgrade to the latest version.

Hi,
Thanks for your response,
I have installed winscp(version 4.3.3) in my machine.
the script is working fine
but while sending file it show an error atating that "Ignore permission errors" while sending the file.
please guide me how to correct the error.

Thanks and regards,
Gnana sundram.
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
gnanasundram wrote:

I have installed winscp(version 4.3.3) in my machine.
the script is working fine

Why did you install v4.3.3 and not the latest version 4.3.7?

gnanasundram wrote:

but while sending file it show an error atating that "Ignore permission errors" while sending the file.
please guide me how to correct the error.


Does your account have access to upload files to the server?
Guest




yes the account has the access to the server
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
Have you read these FAQs?
http://winscp.net/eng/docs/faq_not_owner
http://winscp.net/eng/docs/faq_script_ini
_________________
Martin Prikryl
clt

Guest


Hi Martin, or anybody..
Is it possible to control the order of files uloading on the server? I have .gpg and .chk files and winscp uload .chk firstly (I assume that in alphabetical order). I need to upload e.g. first.gpg, then first.chk, second.gpg then second.chk etc. Thank you!
TimU
[View user's profile]

Joined: 2012-01-30
Posts: 25
Location: Sydney
clt wrote:
Hi Martin, or anybody..
Is it possible to control the order of files uloading on the server? I have .gpg and .chk files and winscp uload .chk firstly (I assume that in alphabetical order). I need to upload e.g. first.gpg, then first.chk, second.gpg then second.chk etc. Thank you!


You could either:
1) Script it externally then call WinSCP with a known list of files to transfer.
2) Run multiple WinSCP passes over your source directory, first transferring *.gpg, then *.chk.

Here's an extract of a Windows Batch script that will append file names to an existing SFTP Batch Script
--------------------------------
DIR /a-d /b *.gpd %source.path% >%SFTP.batch.filelist%
DIR /a-d /b *.chk %source.path% >>%SFTP.batch.filelist%

:: If there are no files in the source directory to transfer, leave the script.
if errorlevel==1 (@ECHO Nothing To Do - Exiting Script)&(Goto :EOF)

@ECHO File Listing Complete

:: Now echo the file names to the script, including the SFTP.OPERATION we want to perform.
@ECHO Echo the file names to the SFTP Script file
for /f "tokens=*" %%A in (%SFTP.batch.filelist%) do (echo PUT -preservetime "%%A" >>%SFTP.batch.script%)

--------------------------------
moonchild18

Guest


# Automatically abort script on errors
option batch abort
# Disable overwrite confirmations that conflict with the previous
option confirm off
# Connect using a password
open sftp:// .....
# Change the Local Directory
lcd "E:\Export Data\"
# Change remote directory
cd /Home/
# Force binary mode transfer
option transfer binary
# List the local files
lls
# List Remote Files
ls
# Upload the files to current working directory
put *.csv
# Disconnect
close
# Exit WinSCP
exit

The following script is loading only one file to the sftp server instead of loading all the files.

I'm using winscp517 version.

Can you please tell me what I'm doing wrong?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24553
Location: Prague, Czechia
moonchild18 wrote:
The following script is loading only one file to the sftp server instead of loading all the files.

I'm using winscp517 version.

Can you please tell me what I'm doing wrong?

Please start a new thread and 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
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