unable to change the local directory using script command lc

Advertisement

esm3x
Joined:
Posts:
2
Location:
America's North Coast

unable to change the local directory using script command lc

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

Reply with quote

Advertisement

esm3x
Joined:
Posts:
2
Location:
America's North Coast

Doh!

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

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,518
Location:
Prague, Czechia

Re: unable to change the local directory using script command lc

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.

Reply with quote

Guest

Permissions issue

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.

Reply with quote

Advertisement

You can post new topics in this forum