one line command to check file existence and FTP it

Hi all,
I need a batch script to Check for existence of file say i check for files with extension xml.done in C:\Myfile.(This folder contains .xml file and its corresponding .done files)
If the .done file exists then it should FTP the corresponding .xml file to UNIX.
Is this possible to do without creating a filelist?

regards,
Coddy.

HOST='domain.com'
USER='yourid'
PASSWD='yourpw'

for file in *.done
do 
xmlfile=${file%.*}.xml
ftp -n $HOST <<END
quote USER $USER
quote PASS $PASSWD
put $xmlfile
quit
END
done

cheers,
Devaraj Takhellambam

you are using cygwin? or are you referring to a pure batch file on windows?

Its fully batch file on windows..

Regards,
Coddy

Here is a skeleton batch script to create a file list if DONE files exist.
The script exits if there are no files.

@echo off
REM IF_TEST.BAT
CD C:\MYFILE
IF EXIST DIRLIST.TXT ERASE DIRLIST.TXT
REM Create list of files if there are any
IF EXIST *.DON DIR *.DON /B > DIRLIST.TXT
REM Exit script if no files found
IF NOT EXIST DIRLIST.TXT ECHO No DONE files found
IF NOT EXIST DIRLIST.TXT EXIT /B
REM Read back files list
TYPE DIRLIST.TXT

Providing that there is a simple relationship between the filenames,
converting the file extension can be done with the FOR command (see FOR /?).

Hey is there any option to FTP the files from Windows to UNIX without creating a filelist ??
A single line command is preferable..
Regards,
Coddy.

no. the native FTP client from windows just cannot cut it. use a better FTP client, or code your ftp commands in the batch itself, echoing them to ftplist, then remove ftplist when finished.
OR, use another programming language that supports the FTP protocol, eg Perl or Python.