Topic "unable to change the local directory using script command lc"

Author Message
esm3x
[View user's profile]

Joined: 2015-03-30
Posts: 2
Location: America's North Coast
Good day, all,

I am trying to run a script to connect to an SFTP site, change to a folder on the site and then push files from three different folders on my local machine to the SFTP folder.
I am unable to change to the local folders.

Here is the script:
# End script on error
option batch abort
# No confirmations
option confirm off
# Connect to SFTP server
open sftp://username:password@ftpaddress:port/ -hostkey="ssh-rsa #### xx:xx:xx:xx:xx:..."
# change SFTP directory
cd /FTPfolder
# change local dir
lcd T:\start\one\two
# Upload file(s)
mput two*.*
# change local directory
lcd T:\start\one\three
# Upload file(s)
mput three*.*
# Change local directory
lcd T:\start\one\four
# Upload file(s)
mput four*.*
# Disconnect
close
exit

The script is launched from the T:\start folder

Here is the error:
> 2015-03-27 13:37:17.040 Script: lcd T:\start\one\two
> 2015-03-27 13:37:17.040 Script: Parameter: T:\start\one\two
< 2015-03-27 13:37:17.040 Script: Error changing directory to 'T:T:\start\one\two'.
< 2015-03-27 13:37:17.056 Script: System Error. Code: 2.

< 2015-03-27 13:37:17.056 The system cannot find the file specified
. 2015-03-27 13:37:17.056 Script: Failed

I've tried these commands, all have failed:
lcd T:\start\one\two
lcd T:/start/one/two
lcd .\one\two
lcd ./one/two
lcd \one\two
lcd /one/two
lcd \\fileprint\files\start\one\two
lcd //fileprint/files/start/one/two

If I # (comment) out the lcd commands, and manually place the files into the T:\start folder before running the script, the script completes without an error.

Any suggesions?

Regards,
esm3x
Advertisements
esm3x
[View user's profile]

Joined: 2015-03-30
Posts: 2
Location: America's North Coast
in my cutting and pasting the error log, I pasted and extra T:

The error is actually:
> 2015-03-27 13:37:17.040 Script: lcd T:\start\one\two
> 2015-03-27 13:37:17.040 Script: Parameter: T:\start\one\two
< 2015-03-27 13:37:17.040 Script: Error changing directory to 'T:\start\one\two'.
< 2015-03-27 13:37:17.056 Script: System Error. Code: 2.

< 2015-03-27 13:37:17.056 The system cannot find the file specified
. 2015-03-27 13:37:17.056 Script: Failed
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24997
Location: Prague, Czechia
Windows error code 2 is "file not exists" (I'm sure the log shows the message too).
How do you run the script? Make sure the account/environment the script is running in sees the T: drive.
_________________
Martin Prikryl
Guest




Thanks for the reply. Over the past few days we figured out there was a security issue. Even through the admin group was in both the NTFS and share permissions, and the user was a member of the NTFS admin group, we needed to add the user who was running the script explicitly to both as an admin. Still trying to work that out but the script now runs and we can change the local directory to push files from all.

Thanks again.
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