Petri.com forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Windows Scripting > DOS Command Shell
Petri.com is happy to award RicklesP the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read
Notices

ftp using windows batch file and redirecting each step in log file

ftp using windows batch file and redirecting each step in log file

this thread has 2 replies and has been viewed 12437 times

Closed Thread
 
Thread Tools Search this Thread Display Modes
  #1  
Old 16th November 2010, 15:34
anks anks is offline
Casual
Casual
 
 Join Date: Nov 2010
  6 month star 12 month star
 Posts: 2
 Reputation: anks is on a distinguished road (10)
Default ftp using windows batch file and redirecting each step in log file

Hi ,

I am trying to do a ftp and just put some files that are transferred from database,

though the ftp is working fine but the moment i try to redirect as to monitor the steps in some log file it is not working i just wonder y?

the same thing was possible to do quite easily in unix

please let me know how i can achieve this.

below is my script:

ftp -d -v -i ACCMAIN > accmain_status.log
user ACCUSER userpwd
type ascii
delete 'ACCMAIN.DATA.DEV'
site lrecl=289
put ACCMAIN.DATA.DEV 'ACCMAIN.DATA.DEV'
quit



on executing this the cursor just blinks in the command prompt, the problem all here is with the way i have redirected the output to log file. Someone please help me the best way to achieve it, as i am novice to windows batch programming.


in unix we use the same as

ftp -d -v -i ACCMAIN <<XEND > accmain_status.log
user ACCUSER userpwd
type ascii
delete 'ACCMAIN.DATA.DEV'
site lrecl=289
put ACCMAIN.DATA.DEV 'ACCMAIN.DATA.DEV'
quit
XEND

What can be the equivalent dos command for XEND here ?


P.S the server name and userid and pwd are changed.
  #2  
Old 16th November 2010, 22:25
vonPryz vonPryz is offline
Member
Here to help
 
 Join Date: Oct 2008
  6 month star 12 month star
 Location: Finland
 Posts: 354
 Reputation: vonPryz will become famous soon enough (80)
Default Re: ftp using windows batch file and redirecting each step in log file

Take a look at Windows FTP command line switches: ftp -?

You'll note that ftp.exe assumes you to put your script commands into a file and pass the file contents as an argument to the program.

I've never heard about XEND command, so I have no idea what the equivalent would be.

-vP
  #3  
Old 20th November 2010, 23:37
SUBHASHCHY SUBHASHCHY is offline
Casual
Casual
 
 Join Date: Nov 2010
  6 month star 12 month star
 Posts: 3
 Reputation: SUBHASHCHY is on a distinguished road (10)
Default Re: ftp using windows batch file and redirecting each step in log file

Hi,

It can be done using FTP command with -s swith.

1) Create a text file with following contents (Description in brackts , ).Name this txt file as script.txt

o exapmle (name of your ftp server)
user (user name to connect)
passwd (password for that user)
mput or mget file.txt ( your commands which needs to be executed)
exit.



2) Run below command from either a command line or batch file.

ftp -s:C:\script.txt >>C:\ftplog.txt

3) C:\script.txt is the path for that script file and C:\ftplog.txt is the path to the output log file.




-SubhashChy
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Batch file to edit a txt file that is part of a compiled exe file using for /f Sargeo80 DOS Command Shell 3 28th June 2010 15:07
using batch script to delete specific lines to end of file in a text file v.prasad86 General Scripting 3 29th December 2009 00:06
Batch to log Username, Time and Ip-address at login [was: Batch file help] tssizemore82 General Scripting 2 11th August 2009 01:44
Learn how to use a FTP batch file. Shazam General Scripting 5 25th June 2009 17:03
Network Log Batch File kio Windows 2000 Pro, XP Pro 10 28th April 2009 20:29


All times are GMT +3. The time now is 20:42.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
 

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri