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 58493
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:51:23+00:00 2026-05-10T17:51:23+00:00

I need to send a very specific (non-standard) string to an FTP server: dir

  • 0

I need to send a very specific (non-standard) string to an FTP server:

dir 'SYS:\IC.ICAMA.' 

The case is critical, as are the style of quotes and their content.

Unfortunately, ftplib.dir() seems to use the ‘LIST’ command rather than ‘dir’ (and it uses the wrong case for this application).

The FTP server is actually a telephone switch and it’s a very non-standard implementation.

I tried using ftplib.sendcmd(), but it also sends ‘pasv’ as part of the command sequence.

Is there an easy way of issuing specific commands to an FTP server?

  • 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. 2026-05-10T17:51:24+00:00Added an answer on May 10, 2026 at 5:51 pm

    Try the following. It is a modification of the original FTP.dir command which uses ‘dir’ instead of ‘LIST’. It gives a ‘DIR not understood’ error with the ftp server I tested it on, but it does send the command you’re after. (You will want to remove the print command I used to check that.)

    import ftplib  class FTP(ftplib.FTP):      def shim_dir(self, *args):         '''List a directory in long form.         By default list current directory to stdout.         Optional last argument is callback function; all         non-empty arguments before it are concatenated to the         LIST command.  (This *should* only be used for a pathname.)'''         cmd = 'dir'         func = None         if args[-1:] and type(args[-1]) != type(''):             args, func = args[:-1], args[-1]         for arg in args:             if arg:                 cmd = cmd + (' ' + arg)         print cmd         self.retrlines(cmd, func)  if __name__ == '__main__':     f = FTP('ftp.ncbi.nih.gov')     f.login()     f.shim_dir(''blast'') 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need send certain attributes(say, human readable user name) from server to client after
I'd like to send a specific UDP broadcast packet. Unfortunately, I need to send
I have a very complex system (100+ threads) which need to send email without
I'm very much new to objective C. I have a case where I need
I need a 3D engine for a very specific task in Artificial Intelligence, and
I need to send certain data to the server in a .zip archive, over
I'd like to use Log4J to send output of a very specific nature to
I need to send hundreds of newsletters, but would like to check first if
I need to send and receive data over serial connections (RS-232 and RS-422). How
I need to send MMS thought a C# application. I have already found 2

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.