FTP - in one batch file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Message
Author
Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: FTP - in one batch file?

#31 Post by Adrianvdh » 29 Sep 2013 15:02

The file I am downloading is a batch file which currently is 107KB. So I find ASCII to be better.
Binary tends to corrupt the file.

Reading N'a, JC. I prefer to watch tutorials (because I am a visual learner). such as thenewboston on youtube.
He does make great tutorials.

So any luck on that ps script? It should look familiar if it does look familiar. I haven't modified it.

If you can get it to download or have an option to download in ASCII that would be great.

Thanks

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: FTP - in one batch file?

#32 Post by penpen » 29 Sep 2013 15:16

Adrianvdh wrote:So I find ASCII to be better.
Binary tends to corrupt the file.
What i've wanted to say above:
You are wrong: Transfering in ASCII mode tends to corrupt data, as the byte value 128 then is transformed to 0, 129 to 1, 130 to 2, ... .
Transfering in binary mode does not change data intentionally.

Adrianvdh wrote:So would you be interested in telling me how many languages you know.
I know:
commodore basic, batch, turbo pascal, logo, c, c++, assembler, html, xml, (xhtml,) javascript, java, latex, perl, matlab, haskell, lisp, c#, vbs, jscript, powerscript, svg, b r a i n f u c k, b r a i n f u c k 2 d, spl (shakespeare programming language), whenever, lolcode, whitespace, hq9, java2k, intercal, Fortran, cobol, delphi (objective pascal), objective c, modula, ... .
But all after b r a i n f u c k 2 d i haven't used, i only know them, and yes i've programmed exactly one b r a i n f u c k program... (i should have avoided that).
(The b r a i n f u c k, and b r a i n f u c k 2 d doesn't contain any whitespaces, but i have to do it because if don't add whitespaces you only can read **censored**; and YES the language has this (rude) name.)

penpen

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: FTP - in one batch file?

#33 Post by aGerman » 29 Sep 2013 15:44

If you uploaded the file in ASCII mode you should download a Batch file in ASCII mode as well. The reason why it's getting corrupted in BINARY mode is that the line breaks are adopted from the servers operating system (often Linux) otherwise.

If you want to learn another programming language I find it not helpful to learn Batch first. It follows a completely different concept and the syntax isn't comparable with any other language.

There is definitly no answer to the question "What programming language is the best?". It depends on the purpose of your programming and the syntax you like.

Nowadays managed object oriented languages like Java (platform independent) or C# (Windows only unless you use Mono) would be a good choice in my opinion.
My favorite is C (even if I also know a few other languages) but I do NOT recomment you to learn it because it would be counterproductive if you want to learn an object oriented language later and you are fully responsible for the memory management which is made for masochists.

Regards
aGerman

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: FTP - in one batch file?

#34 Post by penpen » 29 Sep 2013 16:50

In this case:
The file is not getting corrupted while downloading, it was corrupted when uploading in textmode.
In binary mode you download the corrupted data as it actually is.
The server may automatically reconstruct it, when downloading in ascii mode, but the error was caused by server sided reformating of the (text) data, and has only few to do with binary or ascii transfer mode, but many with the server behavior, that should (hopefully) be controllable by server settings.

If not force the server to use binary mode as i suggested above... although i haven't explained well, why all this happens... .

penpen

Edit:
But you two are right, it could also be fixed by using ascii transfer mode, but this assumes that the server IS reconstructing the ascii data when downloading in ascii mode (there is no guarantee that the server behaves in this way).

Btw: The function DownloadFile of System.Net.WebClient is using the default browser to download unknown files and known non-text files using binary mode and known text files using text mode.
Most servers in inet don't reconstruct the html files, that are downloaded in text mode.

So just try to save the file as a "txt" file on the server, and try out if it reconstructs the line breaks.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: FTP - in one batch file?

#35 Post by aGerman » 29 Sep 2013 17:04

Yeah that's what I meant. Thanks for explaining more clearly.

Rydell
Posts: 11
Joined: 02 May 2013 17:45

Re: FTP - in one batch file?

#36 Post by Rydell » 29 Sep 2013 17:23

foxidrive wrote:
Rydell wrote:then verify it was downloaded(but not its integrity)? If so, the following works for me:

IF EXIST "C:\Program Files\MyProgram\MyProgram.exe" echo File Downloaded.
IF NOT EXIST "C:\Program Files\MyProgram\MyProgram.exe" echo File Not Downloaded.


It could be a zero byte file, so that check is pretty pointless.


I figured what they were asking made it pretty pointless, that's why I said "and not an integrity check?" But, are we worried the file will only half download or something?

Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: FTP - in one batch file?

#37 Post by Adrianvdh » 30 Sep 2013 04:27

OK, aGerman and penpen I will give that a try :).

penpen, do you know all those languages that YOU, YES YOU CAN CODE with? Or are you just listing the NAMES of languages you
know. I can also list a lot of languages, duh?

I meant what languages do you know that you can code with?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: FTP - in one batch file?

#38 Post by penpen » 30 Sep 2013 05:54

Languages than i can use without thinking too much:
commodore basic, batch, turbo pascal, logo, c, c++, assembler, html, xml, (xhtml,) javascript, java, latex, perl, matlab, haskell, lisp, c#, vbs, jscript, powerscript, svg
(This should be the chronology order i had learned them.)

The language that i am able to use, but with headache:
b r a i n f u c k

All others i have to do some lookup, although the syntax may look familiar, so reading the code is no (big) problem to me (except whitespace for this i have first to replace some characters to be able to read it).

penpen

Edit: My favorites are C++, Java, and the weblanguages (html, xml, xhtml, javascript, svg)
Last edited by penpen on 30 Sep 2013 06:30, edited 1 time in total.

Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: FTP - in one batch file?

#39 Post by Adrianvdh » 30 Sep 2013 06:28

So how long have you been studying these? Did you go to university? When did you start?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: FTP - in one batch file?

#40 Post by penpen » 30 Sep 2013 06:36

1) it took me round about 22 years, so nearly 1 language per year.
2) Yes, i did. But commodore basic, batch, turbo pascal, logo, c, c++ assembler i have learned prior.
3) Since i was 14 (commodore basic), since 16 the others.

Btw: You may also use private message system.

penpen

Adrianvdh
Posts: 177
Joined: 16 May 2013 13:00

Re: FTP - in one batch file?

#41 Post by Adrianvdh » 30 Sep 2013 08:40

Oh ok :) That is cool :)

Post Reply