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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T14:29:18+00:00 2026-06-17T14:29:18+00:00

I have a Java code that transfers file from FTP on Mainframe to my

  • 0

I have a Java code that transfers file from FTP on Mainframe to my local system . The problem is how do I tell if the given path is a file or folder ? I cannot use the check for extensions as i don’t know what the possible extensions can be . Also the following code always returns false ,

 fileSystem.isFile("fileName");

Being a mainframe filesystem , the path is seperated by . instead of / and hence a check for . at the end also doesnt work.

Again I stream data from the input path to output location using

url="connection url of the mainframe"
bufferedInputStream = new BufferedInputStream(url.getInputStream());

When I have files at the source path , it writes the content of the file to the destination , and when the source path has a directory it writes the the names and other properties of the files at the directory to the destination.

Sample output when the source is a directory is

Name    VV.MM   Created       Changed          Size  Init    Mod    Id
QQQQ    01.00  2009/12/18   2009/12/18 12:15    18    18     0    XXXX 
RRRR    01.00  2009/12/18   2009/12/18 12:16     19     19    0  XXXXX

How do I determine if the source path is a file or folder ?

  • 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-17T14:29:19+00:00Added an answer on June 17, 2026 at 2:29 pm

    I found a way to determine if the path on mainframe is a file or PDS (analogically a directory ) . I used org.apache.hadoop.fs.ftp.FTPFileSystem library and the following snippet would work by returning the list of files .

    FTPFile[] files = ftp.listFiles(); 
    

    Looping through the files and checking file1.isFile() would suffice.
    Again remember to change to the current working directory before listing the files using ftp.cwd(inputPath);

    For an explanation on Mainframe file system please refer to Bruce Martin’s answer and the comments that follow. .

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

Sidebar

Related Questions

I have the following piece of Java code that reads strings from CSV file.
In my Java code I have function that gets file from the client in
I have a simple java code that reads text csv file that contains sentences
I have a developed a code that reads very large files from FTP and
I have this java code that renames a file (or directory). There is a
I have some Java code that is throwing out of memory exceptions after running
I have some Java code that connects to an Oracle database using DriverManager.getConnection(). It
I have a java code that looks like this: //UI thread //Some code Job
I have existing java code and need to create Design Document based on that.
Here is the piece of code that I have used for Java 5.0 TreeSet<Integer>

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.