aspose file tools*
The moose likes Linux / UNIX and the fly likes Batch File Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Batch File" Watch "Batch File" New topic
Author

Batch File

Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25
Hi Techies,


I want to create a batch file to automatic download logs from remote server over internet.I checked it out on google ,but not find out any appropriate help to proceed further.
Please help me in creating this.




Thanks,
Rahul
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

If you can elaborate your question more clearly, we may be able to help. Nevertheless, you can try tools like ftp, scp, wget, etc.


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

DOS has batch files. Linux has scripts.


Customer surveys are for companies who didn't pay proper attention to begin with.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

inside your 'batch file" or shell script, you will want to use a commands such as either wget or curl
Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25
I am working on windows so i want to create a batch file , which on particular run download all the log files from remote server via internet and store on given path directory in my system (remote server is on different country).

This is all about where i need help.


Thanks,
Rahul
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4659
    
    5

Rahul Sud wrote:I am working on windows so i want to create a batch file

When I need to do complicated stuff in a Windows cmd script, I use perl. Check out ActiveState's open source perl.

Perl has the fundamental primitives to do the stuff you want, fairly easily.
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Rahul Sud wrote:I am working on windows so i want to create a batch file , which on particular run download all the log files from remote server via internet and store on given path directory in my system (remote server is on different country).

This is all about where i need help.


What services does the server offer?
Are you free to decide that?
Is the server running linux?

There are a lot of ways to solve the problem - maybe you can configure the logger to send the logs via email. You can offer a ssh-daemon, which can be accessed automatically by shared keys, and you could get the files with scp.

http://en.wikipedia.org/wiki/Secure_copy

I don't see much room for perl, btw.

And 'batch-file' seems to me to be a perfectly reasonable name - a script might be a batch file, if it doesn't use threads, which sounds pretty reasonable for this kind of job - do one command after the other.

http://en.wikipedia.org/wiki/Batch_processing

http://home.arcor.de/hirnstrom/bewerbung
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

I know I sound pedantic, but while "Batch file" is a term that may have been used on some mainframes, for most people it has always meant a DOS script (".BAT"). It's worth remembering, because people on less polite forums flame you for less than that. Mostly because they're jerks, but the BAT command processor is pretty brain-dead compared to your average scriptable shell. Linux has a "batch" capability, but it refers to batch in the sense that processing is non-interactive, not the act of scripting.

Of course, these days, Windows has the incredibly stupid batch shell (COMMAND.COM), the merely stupid batch shell (CMD.EXE) and the "look-at-me" Windows Scripting shell, which I've never actually used myself.

Even a COMMAND.COM .BAT file can download a set of files, though. All that is required is that the host make them available via FTP. The Windows command-line FTP client (named, "FTP") can accept FTP batch commands and process them. "FTP Batch commands" isn't the same as a BAT file. It simply means a canned set of FTP commands in a text file that's read and processed by FTP. Unlike BAT files, which are read and processed by COMMAND.COM.
Rahul Sud
Greenhorn

Joined: May 27, 2008
Posts: 25

First of all thanks to all for the comments.But i need more clarification as i have not much idea about the batch file etc.

My Original question was this :

I am working on windows so i want to create a batch file , which on particular run download all the log files from remote server via internet and store on given path directory in my system (remote server is on different country).




I will make it more elaborated.
Currently I am downloading logs via ssh FTP tool by manually click on that each time and save it in the specified folder.This is downloading logs from say Country X and I am in Country Y via a particular internet address with user id,password and port.
I don't want to do monitoring and want to do this work automate with batch file.So that whenever i need to download logs or file from ssh(server) which is on linux to my workstation which is on windows it will process in the automate way without any continuous monitoring.


This is all about where i need help.



Thanks,
Rahul


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16070
    
  21

OK. Sounds like you should get the "pscp" program from the PuTTY project.

You shouldn't actually need a batch file, since pscp can copy multiple files over ssh. Or if you do use a batch file, the only thing in it would be the "pscp" command line.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Batch File