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

  • Home
  • SEARCH
  • 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 8221729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:01:56+00:00 2026-06-07T14:01:56+00:00

I am writing a c++ program that interfaces with an Apache FtpServer using libcurl.

  • 0

I am writing a c++ program that interfaces with an Apache FtpServer using libcurl. I was originally using the LIST command to get the contents of a directory but it was giving me a lot of information I didn’t but had to parse any ways which lead to a lot unneeded overhead (especially when I was working with hundreds of thousands of files). In addition I needed a valid time stamp and it was giving me a shorthand that didn’t include the year (so on January 1 all of the files on my computer looked outdated compared to the FTP server’s). My solution was to use the NLST command to get only the names, then download the timestamps of each using MDTM. This worked awesome but then I ran into the major problem of not being able to tell if a file was a directory or not.

I am thinking the easiest way to do this is using the permissions to see if the first flag is set to d. FTP doesn’t appear to have this functionality. Is there an easy way to tell if a filename is a directory or file?

  • 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-07T14:01:58+00:00Added an answer on June 7, 2026 at 2:01 pm

    You can try to use the CWD command on the file to test if it is a directory or not. But failure may mean lack of permission, so you need to check the error code. For example:

    ftp> cd atom.xml
    550 Can't change directory to atom.xml: Not a directory
    

    Alternatively, you can use the NLST command again on the file you want to test. If it is a plain file, you will just get the filename back. Otherwise, you will get a list of contents of the directory.

    ftp> nlist atom.xml
    200 PORT command successful
    150 Connecting to port 53912
    atom.xml
    226 1 matches total
    
    ftp> mkdir foo
    257 "foo" : The directory was successfully created
    ftp> nlist foo
    200 PORT command successful
    150 Connecting to port 53928
    226 0 matches total
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a program that's parsing an XML file to java objects using smooks.
I am writing a program that permutes a list of names based on a
I'm writing a program using the Managed WiFi API . Here's how I get
I'm writing a program that will watch a particular directory for new files containing
I'm writing a program using jdbc that will be an interface to database(smth like
I am writing a program written in C# that interfaces with a Sage Payroll
I am writing C# code that interfaces to a legacy (Feb 2012) C program,
I am writing a program (.net 4) that interacts with an external COM object.
Im writing a program that should read input via stdin, so I have the
I'm writing a program that handles DBs and writes any changes into ListView for

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.