login about faq
REM ############################################
REM ####          INITIAL SETTINGS:         ####
REM ############################################

FOR /F "TOKENS=2-4 DELIMS=/ " %%a IN ("%date%") DO SET mm=%%a&SET dd=%%b&SET yy=%%c
FOR /F "TOKENS=1-3 DELIMS=:." %%a IN ("%time%") DO SET hh=%%a&SET tt=%%b&SET ss=%%c
set current=%yy%%mm%%dd%-%hh%h.%tt%m.%ss%s

set LogFile="%current%.txt"
set ErrorLog="%current%_ERROR.txt"
echo "%LogFile%" > %Logfile%
set FTPCommands=x:\myfile.txt
set FileTransferClient=sftpg3.exe

REM ############################################
REM ####    FILE TRANSFER COMMAND:          ####
REM ############################################

%FileTransferClient% -D 8 --password=file://x:\pass.txt -B %FTPCommands% star@x.x.x.x >>%LogFile% 2>>%ErrorLog%

set SFTP_ERROR_LEVEL=%ERRORLEVEL%

REM ############################################
REM ##   Check if errors are found            ##
REM ############################################

echo SFTP ERROR LEVEL IS %SFTP_ERROR_LEVEL% >>%LogFile%

if %SFTP_ERROR_LEVEL% NEQ 0 GOTO ERROR


::Following will move local files after successful upload operation and delete error log
del %ErrorLog%
move /y x:\*.*  x:\History
GOTO EXIT

:ERROR
:: Following will send stderr log to the email address
x:\bmail -s 192.168.x.x -t me@you.co.uk -f with@you.co.uk -h -a "Problem found: File transfer log" -m %ErrorLog% -c 

goto EXIT

:EXIT

asked May 13 '10 at 13:46

taj's gravatar image

taj
111

edited Jun 14 '10 at 07:02

Ville%20Laurikari's gravatar image

Ville Laurikari
131129

You'll be much more likely to get a useful answer if you provide some details on what the script is supposed to do, how exactly does it fail, and what you have done so far to troubleshoot the issues.

(Jun 14 '10 at 07:04) Ville Laurikari Ville%20Laurikari's gravatar image
Be the first one to answer this question!
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×63
×55
×2

Asked: May 13 '10 at 13:46

Seen: 3,247 times

Last updated: Jun 14 '10 at 07:02

All user contributed content licensed under the cc-by-sa license.
Powered by OSQA.