Topic "Uploading single file (Whitespaces)"

Author Message
jxk7581
[View user's profile]

Joined: 2008-04-30
Posts: 2
I am attempting to integarte WinSCP into a larger project which will generate a Batch file to execute PGP and FTP commands. WinSCP will be used to execute single file transfer commands using the /command option (See https://winscp.net/eng/docs/script_upload_single_file)

The problem I have is in dealing with whitespaces in either the directory path or file name. Below is the single command line statement to send a file. Since both the Directory and File name contain whitespaces, I get the "File or folder xxxxx Does not Exist" error. I've tried many different options (Single Quotes, double quotes, Brackets) to enclose around the path & filename with no luck.

Your help is appreciated!!! Smile

"C:\Program Files\WinSCP\winscp.com" skype@ftp.uppquad.com /command "option confirm off" "put Y:/UQ Feed/Encrypted/RISE GA-Net Units-Daily Report-MTD-20080430.csv.pgp /NAR/" "exit"
Advertisements
jrynd
[View user's profile]

Joined: 2008-04-03
Posts: 20
Location: New York
It's kind of hard to put everything on one command line.

You'd probably have more luck creating a command file (see https://winscp.net/eng/docs/scripting ). That way you could use quotes in the middle of each command.
jxk7581
[View user's profile]

Joined: 2008-04-30
Posts: 2
jrynd wrote:
It's kind of hard to put everything on one command line.

You'd probably have more luck creating a command file (see https://winscp.net/eng/docs/scripting ). That way you could use quotes in the middle of each command.


Thanks for the suggestion.

I'm really trying to avoid that. I have a Database of all of the different files, FTP|SFTP sites, PGP Keys, folders, and destinations. A script reads from the DB to create a single batch file to execute gpg and winscp for each file or group of files. Using a command file would mean I would have to break up my single batch file into multiple file executions.

I DID have some luck Very Happy reformatting folders and files from "C:\ABC DEFGHI\" to "C:\ABCDEF~1\" but I would have to write some formulas in my batch file creation to identify whitespaces and reformat any folders|files appropriately. I'm really hoping for a miracle here.
jrynd
[View user's profile]

Joined: 2008-04-03
Posts: 20
Location: New York
jxk7581 wrote:
I have a Database of all of the different files, FTP|SFTP sites, PGP Keys, folders, and destinations. A script reads from the DB to create a single batch file to execute gpg and winscp for each file or group of files. Using a command file would mean I would have to break up my single batch file into multiple file executions.


You pass the command file you want to use as a parameter when you call winscp. Create the multiple command files and pass them in. You still only need one batch file.

And while I'm at it, why bother calling WinSCP multiple times? Just make one WinSCP command file that handles all the WinSCP stuff. It can connect to a server, do stuff, disconnect, and then connect to a different server.

jxk7581 wrote:
I DID have some luck :D reformatting folders and files from "C:\ABC DEFGHI\" to "C:\ABCDEF~1\"


Ever hear of dir /x filename ?
Guest




The reason I am passing the command file multiple times is because each file will be going to a different FTP destination. I was trying to avoid creating multiple command files as these are actually being generated by a database query.

Your suggestion of one command file with multiple open, put, close commands would work. I could just keep the same .bat file to execute winscp on this dynamic command file. The only "down" side is I will have to have a separate DB query to generate my PGP Encryption .bat file. I'll let you know how it works.

Also, I have not heard of dir /x filename.
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24993
Location: Prague, Czechia
Quote:
Your suggestion of one command file with multiple open, put, close commands would work. I could just keep the same .bat file to execute winscp on this dynamic command file. The only "down" side is I will have to have a separate DB query to generate my PGP Encryption .bat file. I'll let you know how it works.

WinSCP 4.1 supports using environment variables in script file. So you can have one script file and set its parameters in your batch file using the variables. See FAQ.

As for your original question about spaces, see another documentation.
_________________
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