Topic "Get Problem - wrong path"

Author Message



i got this problem with my script:

i call a cmd-file that calls another cmd-file to get files from FTP

First file: BNN.cmd
SET lieferdev=d:
SET BNNDIR=%lieferdev%\transfer\batch\ftp
SET LOG_DATEI_CEXT=%bestelldev%\transfer\batch\ftp\bnn.log
if exist %BNNDIR%\BNN_xxx.cmd call %BNNDIR%\BNN_xxx.cmd

Second file: BNN_xxx.cmd
SET lieferdev=d:
SET lieferdir=%lieferdev%\transfer\batch\ftp
SET orderdir=%lieferdev%\transfer\dfue\import
SET xxxdir=%orderdir%\xxx
IF NOT EXIST %xxxdir% MKDIR %xxxndir%
SET xxxbck=%xxxdir%\backup
SET xxxlog=xxxlog.txt
SET xxxfile=d:\transfer\batch\ftp\BNN_xxx.txt
"d:\transfer\batch\Winscp\" /script=d:\transfer\batch\ftp\BNN_xxx.txt
if not exist d:\transfer\batch\ftp\PL*.* goto ENDE
COPY d:\transfer\batch\ftp\PL*.* d:\transfer\DFUE\Import\xxx\*.*

Third file: BNN_xxx.txt
mget PL*.BNN
mget PLU0*.BNN
rm PL*.BNN
rm PLU0*.BNN

the problem is that the files i download from the ftp will be saved at d:\transfer if i start bnn.cmd.
AND the files saved in d:\transfer\batch\ftp if i start bnn_xxx.cmd.

Why the files stored in different path?
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 27086
Location: Prague, Czechia
As you do not specify a target path in WinSCP script, nor you set a current working directory in your batch files (nor the WinSCP script), the files are downloaded to the current working directory.

If you execute the batch file from Windows Explorer, the current working directory will, by default, be the directory, where the batch file is stored.

You can post new topics in this forum


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!


About donations

$9   $19   $49   $99

About donations


WinSCP Privacy Policy

WinSCP License