Discussion forum for all Windows batch related topics.
Moderator: DosItHelp
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#76
Post
by abc0502 » 29 Nov 2012 00:10
Every Thing is fixed now

you can add this to create the local folder if not exist to prevent errors
Code: Select all
::Create Local Folder if not exist
IF not Exist "%~6" MD "%~6" >nul
add in line 13, i will edit it in the code.bat
-
aaksar
- Posts: 105
- Joined: 17 Nov 2012 05:13
#77
Post
by aaksar » 29 Nov 2012 00:27
for the zip
i need to give
Code: Select all
set "zip_program=%programfiles%\zip\compact.exe"
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#78
Post
by abc0502 » 29 Nov 2012 00:29
i'm still trying to make it unzip zipped file but not working yet, check back in 10 min maybe i could find any help about that tool
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#79
Post
by abc0502 » 29 Nov 2012 00:36
it refuse to unzip a zipped file i made by 7z so can you try this command at your pc
and make sure that the folder is containing at least two zipped archives so we can make sure it can do it.
and is it ok if you used 1 exe utility to unzip files
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#80
Post
by abc0502 » 29 Nov 2012 00:39
don't forget to go to the directory where the files is by using the CD command
One more thing, does java installed on the computer where you will run the batches, to check write "java" in your cmd window and if help documenst appeared so it is installed.
BTW, the tool that i'm talking about is unzip.exe it's 164kb so no big size or installation
-
aaksar
- Posts: 105
- Joined: 17 Nov 2012 05:13
#81
Post
by aaksar » 29 Nov 2012 00:53
its still opening 2 cmd window and files not copied
result
Code: Select all
The system cannot find the file specified.
ftp> open ftp.us.abc.com
User (ftp.us.abc.com:(none)):
ftp> lcd "D:\test"
Local directory now D:\Test.
ftp> cd "%G"
%G: The system cannot find the file specified.
ftp> disconnect
ftp> Bye
2nd window
Code: Select all
The system cannot find the file specified.
ftp> open FTP_SERVER
Unknown host FTP_SERVER.
ftp> USER_NAME
Invalid command.
ftp> PASSWORD
Invalid command.
ftp> lcd "LOCAL_FOLDER"
Local directory now C:\Users\service_infa\LOCAL_FOLDER.
ftp> cd "%G"
Not connected.
ftp> disconnect
Not connected.
ftp> Bye
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#82
Post
by abc0502 » 29 Nov 2012 01:02
sorry for that , there is a skip parameter missing from the start.bat. i will fix that in the previous code
but i don't understand why when it doesn't take the remote directory and instead it put %G
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#83
Post
by abc0502 » 29 Nov 2012 01:08
i tested it now and it work and change directory on the server

-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#84
Post
by abc0502 » 29 Nov 2012 01:41
Finally, found a way to unzip without external tools by using a vbscript does that work for you
-
aaksar
- Posts: 105
- Joined: 17 Nov 2012 05:13
#85
Post
by aaksar » 29 Nov 2012 02:07
I hv installed 7zip, let me check if it works.
but the script is not working its not copying the file
result is below
Code: Select all
The system cannot find the file specified.
ftp> open ftp.us.abc.com
User (ftp.us.abc.com:(none)):
ftp> lcd "D:\test"
Local directory now D:\Test.
ftp> cd "1 abc Tables"
ftp> disconnect
ftp> Bye
The system cannot find the file specified.
ftp> open ftp.us.abc.com
User (ftp.us.abc.com:(none)):
ftp> lcd "D:\test"
Local directory now D:\Test.
ftp> cd "1 abc Tables"
ftp> disconnect
ftp> Bye
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#86
Post
by abc0502 » 29 Nov 2012 02:28
I tested again and it is working here,
> have you replaced the 7z with zip in the line 18.
> post your FTP.set file content here after removing your ftp, user, password.
> re-copy the files again from the forum to a new batch files and put them all together and test again
> make sure that the local folder has no files.
If all of that didn't work do this
> add pause after line 46 "after the for loop that process the dump.log file"
> go to %temp% directory and erase all files there
> then run the start.bat & when it ask you to press any key to continue go back to the %temp% dir and open one of the two folders "there names is numbers" and open the file "server_list.lst" and tell me does the file names there is the files names on the ftp server or not? and does they all between two double quotes ?
-
aaksar
- Posts: 105
- Joined: 17 Nov 2012 05:13
#87
Post
by aaksar » 29 Nov 2012 03:38
ftp.set
Code: Select all
FILE_LIST;FTP_SERVER;USER_NAME;PASSWORD;MAX_NUMBER_TO_DOWNLOAD;LOCAL_FOLDER;REMOTE_FOLDER
FILE.lst;ftp.us.abc.com;Ftp0013;^^abcd3;12;D:\test;1 abc Tables
names are in Double quotes, and still i am not seeing get command on cmd.
file not moved
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#88
Post
by abc0502 » 29 Nov 2012 03:47
Ok, make sure that the local folder in your hdd is empty and do this:
> remove the previous pause
> add pause after this line )>>"%temp%\%~8\commands_2.ftp"
then run the start.bat again and do the same then go to %temp% dir and this time post the content of the dump.log, command_1.ftp, server_list.lst and command_2.ftp and replace the file names if needed and also don't forget to remove the user name and password from the command_1.ftp
-
aaksar
- Posts: 105
- Joined: 17 Nov 2012 05:13
#89
Post
by aaksar » 29 Nov 2012 04:27
Command1.ftp
Code: Select all
open ftp.us.abc.com
Ftp0013
^abc3
cd "1 abc Tables"
ls
disconnect
Bye
command2.ftp
Code: Select all
open ftp.us.abc.com
FtpTemp0013
^abcd3
lcd "D:\test"
cd "1 abc Tables"
dump.log
Code: Select all
ftp> cd "1 abc Tables"
110A_123
115A_1234
301A_12345
302A_abcd
311A_abcde
311B_abcdef
312A_abcdefg
Temp
ftp> ls
ftp> disconnect
Bye
server_list
Code: Select all
"110A_123"
"115A_1234"
"301A_12345"
"302A_abc"
"311A_abcd"
"311B_abcde"
"312A_abcdef"
"312B_abcdefg"
"Temp"
when it pole again in 5 min, it will append same list of file name in server_list file
so after 1 pole there are 2 set of file name
like
Code: Select all
"110A_123"
"115A_1234"
"301A_12345"
"302A_abc"
"311A_abcd"
"311B_abcde"
"312A_abcdef"
"312B_abcdefg"
"Temp"
"110A_123"
"115A_1234"
"301A_12345"
"302A_abc"
"311A_abcd"
"311B_abcde"
"312A_abcdef"
"312B_abcdefg"
"Temp"
-
abc0502
- Posts: 1007
- Joined: 26 Oct 2011 22:38
- Location: Egypt
#90
Post
by abc0502 » 29 Nov 2012 04:52
Ok The files names should be written to the command_2.ftp
so there is only two reasons not happening,
1> This line
Replace it with
2> This line
Code: Select all
IF NOT EXIST "%~6\%%b" echo get %%b >>"%temp%\%~8\commands_2.ftp"
It check if the file name already exist in your local_folder and that mean, the file already exist in your system in that folder that's why it's not downloading.
to check that upload a new file with a new name and add it's name to the File.lst1 then run it after changing
NO#1