Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8404029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:29:29+00:00 2026-06-09T22:29:29+00:00

I am using python ftplib to download builds from the builds ftp server. The

  • 0

I am using python ftplib to download builds from the builds ftp server. The files are about 1.5-1.6 GB.
I use a batch file to run the program. This way it is easier to schedule the download.
The problem is, downloaded files do not seem to work. They throw a compatibility error(windows). If I download the files using FileZilla, the files work fine.
Also, there is a difference of a few hundred B on the source file and the downloaded file. What is going on?

import ftplib, sys, os

ftp = ftplib.FTP("<server_name")
try:
    ftp.login(user= "<user>", passwd = "<password>")
except:
    sys.stderr.write('Could not login.')

data=[]
ftp.dir(data.append)
builds=[]

trg=0           
trg_bld=""
for i in data:
    if len(i.split(" "))>12:
        if len(i.split(" ")[12].split("_"))>2:
    #this line is to find the version on the server
            if (i.split(" ")[12].split("_")[1]== "3.1.0"):
                if int(i.split(" ")[12].split("_")[2])>trg:
                    trg_bld = i.split(" ")[12]

trg_file = trg_bld
print trg_file
if os.path.isfile(trg_file):
    sys.stderr.write('File already exists.')
    sys.exit(1)
f= open(trg_file, "w")
ftp.retrbinary('RETR '+trg_bld, f.write)
f.close()
ftp.close()
sys.stdout.write("File download successful.")

Batch file:
E:
cd E:\Builds
python ftp_sch.py
pause

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:29:31+00:00Added an answer on June 9, 2026 at 10:29 pm

    f= open(trg_file, "w") -> f= open(trg_file, "wb")

    Without the b flag Python thinks you’re writing ASCII and it’s changing the line-endings (hence the size difference and broken binaries).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am FTPing a zip file from a remote FTP site using Python's ftplib.
I have to download some files from an FTP server. Seems prosaic enough. However,
I program a FTP addon (using python's ftplib) and I wonder what would be
Using Python, how would I go about reading in (be from a string, file
I am trying to read files using Python's ftplib without writing them. Something roughly
I need to download a file from a host using SFTP. Do you know
Im trying to download daily a backup file from my server to my local
I'm using python's ftplib to write a small FTP client, but some of the
So lets say I'm using Python's ftplib to retrieve a list of log files
I am trying to use ftps to upload file to our FTP server. Login

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.