Hi Everyone,
I am trying to automate a batch file to constantly check an FTP site and download uploaded files and delete after the upload.
I have the batch file set up to upload the files to another ftp server when there is a succesfull download, log the entire process and rename/move the log file when complete
The problem i am having is that the batch file will download and delete the files mid-upload leaving me with nothing on the server and nothing locally.
what is the best way to set up the batch file to not download the files unless the person uploading is finished uploading?
Here is what i have so far:
@echo off
:LOOPY
echo username> ftpcmd.dat
echo password>> ftpcmd.dat
echo cd foldername>> ftpcmd.dat
echo mget *.*>> ftpcmd.dat
echo mdelete *.*>> ftpcmd.dat
echo bye>> ftpcmd.dat
echo username> ftpcmd1.dat
echo password>> ftpcmd1.dat
echo cd foldername>> ftpcmd1.dat
echo mput *exc*.*>> ftpcmd1.dat
echo quit>> ftpcmd1.dat
ftp -i -n -s:ftpcmd.dat 192.168.1.1 > ftp.log
find "bytes" ftp.log
set error=%errorlevel%
if not %error%==0 goto end2
ftp -i -n -s:ftpcmd1.dat 192.168.0.1 > ftp2.log
ren ftp.log FTPLOG%_%%date:~4,2%%-%%date:~7,2%%-%%date:~10%%.log
move FTPLOG*.log c:\Logs
:end2
del ftpcmd.dat
del ftpcmd1.dat
goto LOOPY --- i want to script to constantly run and not leave files on the ftp sever for long
Any help will be greatly appreciated
Thanks!
Elliot
Only Download Fully Uplaoded files from FTP
Moderator: DosItHelp
Re: Only Download Fully Uplaoded files from FTP
Anybody have any thoughts?
Re: Only Download Fully Uplaoded files from FTP
Egulk,
I don't know how to check if a files is done uploading. Here an alternative that may work for you:
Have the upload script upload the files into a different folder. When done uploading have same upload script move the file over to the target folder with a single FTP "rename" command.
That way you wouldn't have partially uploaded files in your remote target folder.
DosItHelp
I don't know how to check if a files is done uploading. Here an alternative that may work for you:
Have the upload script upload the files into a different folder. When done uploading have same upload script move the file over to the target folder with a single FTP "rename" command.
That way you wouldn't have partially uploaded files in your remote target folder.
DosItHelp
Re: Only Download Fully Uplaoded files from FTP
when would i remove the file from the ftp server?
i was thinking of doing two passes on the file sizes on the server comparing them against each-other for changes and only downloading when they are the same but i cant figure out how to do that...
do you think something like that would work?
and if yes how would i do that?
thanks!
i was thinking of doing two passes on the file sizes on the server comparing them against each-other for changes and only downloading when they are the same but i cant figure out how to do that...
do you think something like that would work?
and if yes how would i do that?
thanks!