Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
807 views
in Java FTP by (230 points)
Following is my code

1]String str[]=proFTPClientInterface.dir(basePart) (basePart=>bhagya/datta)

Following is the log

DEBUG: 2017-01-09 08:34:59,474[Thread-6:ftp.trace]: FTP-REP: 220 Xlight FTP Server 3.5 ready...
DEBUG: 2017-01-09 08:34:59,479[Thread-6:ftp.trace]: FTP-REQ: ---> USER magic
DEBUG: 2017-01-09 08:34:59,795[Thread-6:ftp.trace]: FTP-REP: 331 Password required for magic
DEBUG: 2017-01-09 08:34:59,795[Thread-6:ftp.trace]: FTP-REQ: ---> PASS ********
DEBUG: 2017-01-09 08:35:00,051[Thread-6:ftp.trace]: FTP-REP: 230 Login OK
DEBUG: 2017-01-09 08:35:00,055[Thread-6:ftp.trace]: FTP-REQ: ---> TYPE I
DEBUG: 2017-01-09 08:35:00,148[Thread-6:ftp.trace]: FTP-REP: 200 Type set to I.
DEBUG: 2017-01-09 08:35:00,148[Thread-6:ftp.trace]: FTP-REQ: ---> SYST
DEBUG: 2017-01-09 08:35:00,250[Thread-6:ftp.trace]: FTP-REP: 215 UNIX Type: L8
DEBUG: 2017-01-09 08:35:01,410[Thread-6:ftp.trace]: FTP-REQ: ---> SYST
DEBUG: 2017-01-09 08:35:01,516[Thread-6:ftp.trace]: FTP-REP: 215 UNIX Type: L8
DEBUG: 2017-01-09 08:35:01,518[Thread-6:ftp.trace]: FTP-REQ: ---> PASV
DEBUG: 2017-01-09 08:35:01,698[Thread-6:ftp.trace]: FTP-REP: 227 Entering Passive Mode (31,168,51,222,159,188)
DEBUG: 2017-01-09 08:35:01,741[Thread-6:ftp.trace]: FTP-REQ: ---> NLST bhagya/datta
DEBUG: 2017-01-09 08:35:01,821[Thread-6:ftp.trace]: FTP-REP: 550 Can't find file
DEBUG: 2017-01-09 08:35:02,348[Thread-6:ftp.trace]: FTP-REQ: ---> QUIT
DEBUG: 2017-01-09 08:35:02,380[Thread-6:ftp.trace]: FTP-REP: 221 Good-Bye
 

but when i use other client e.g Filezilla, it works for all ftp operation.is there any solution,please help me to solve this problem
by (161k points)
Try changing into the directory "bhagya/datta" and then listing the current directory.
by (230 points)
i have taken basePart  at run time so it is not required to in this "bhagya/datta" format,here  i just mentioned run time value of  basePart.so please help me
by (161k points)
Instead of calling dir("bhagya/datta" ) or whatever it is, change into that directory first and then call dir().
by (230 points)
See following log after using chdir() method
DEBUG: 2017-01-16 08:43:37,419[Thread-6:ftp.trace]: FTP-REP: 220 Xlight FTP Server 3.5 ready...
DEBUG: 2017-01-16 08:43:37,423[Thread-6:ftp.trace]: FTP-REQ: ---> USER magic
DEBUG: 2017-01-16 08:43:37,849[Thread-6:ftp.trace]: FTP-REP: 331 Password required for magic
DEBUG: 2017-01-16 08:43:37,849[Thread-6:ftp.trace]: FTP-REQ: ---> PASS ********
DEBUG: 2017-01-16 08:43:37,951[Thread-6:ftp.trace]: FTP-REP: 230 Login OK
DEBUG: 2017-01-16 08:43:37,957[Thread-6:ftp.trace]: FTP-REQ: ---> TYPE I
DEBUG: 2017-01-16 08:43:38,226[Thread-6:ftp.trace]: FTP-REP: 200 Type set to I.
DEBUG: 2017-01-16 08:43:38,226[Thread-6:ftp.trace]: FTP-REQ: ---> SYST
DEBUG: 2017-01-16 08:43:38,327[Thread-6:ftp.trace]: FTP-REP: 215 UNIX Type: L8
DEBUG: 2017-01-16 08:43:38,754[Thread-6:ftp.trace]: FTP-REQ: ---> SYST
DEBUG: 2017-01-16 08:43:38,834[Thread-6:ftp.trace]: FTP-REP: 215 UNIX Type: L8
DEBUG: 2017-01-16 08:43:38,835[Thread-6:ftp.trace]: FTP-REQ: ---> CWD bhagya/datta
DEBUG: 2017-01-16 08:43:38,881[Thread-6:ftp.trace]: FTP-REP: 250 Directory successfully changed
DEBUG: 2017-01-16 08:43:38,889[Thread-6:ftp.trace]: FTP-REQ: ---> PASV
DEBUG: 2017-01-16 08:43:39,139[Thread-6:ftp.trace]: FTP-REP: 227 Entering Passive Mode (31,168,51,222,168,238)
DEBUG: 2017-01-16 08:43:39,142[Thread-6:ftp.trace]: FTP-REQ: ---> NLST
DEBUG: 2017-01-16 08:43:39,241[Thread-6:ftp.trace]: FTP-REP: 150 Opening ASCII mode data connection for NLIST (10 bytes).
DEBUG: 2017-01-16 08:43:39,242[Thread-6:ftp.trace]: FTP-REP: 226 Transfer complete (1.429 KB/s).
DEBUG: 2017-01-16 08:43:39,246[Thread-6:ftp.trace]: FTP-REQ: ---> PWD
DEBUG: 2017-01-16 08:43:39,343[Thread-6:ftp.trace]: FTP-REP: 257 "/bhagya/datta"
DEBUG: 2017-01-16 08:43:39,344[Thread-6:ftp.trace]: FTP-REQ: ---> PASV
DEBUG: 2017-01-16 08:43:39,444[Thread-6:ftp.trace]: FTP-REP: 227 Entering Passive Mode (31,168,51,222,168,239)
DEBUG: 2017-01-16 08:43:39,444[Thread-6:ftp.trace]: FTP-REQ: ---> LIST bhagya/datta
DEBUG: 2017-01-16 08:43:39,546[Thread-6:ftp.trace]: FTP-REP: 550 Can't open directory "/bhagya/datta/bhagya/".
DEBUG: 2017-01-16 08:43:39,889[Thread-6:ftp.trace]: FTP-REQ: ---> QUIT
DEBUG: 2017-01-16 08:43:39,903[Thread-6:ftp.trace]: FTP-REP: 221 Good-Bye
by (161k points)
By the looks of this command "LIST bhagya/datta" you are calling dir("bhagya/datta") instead of dir().
by (230 points)
no, i am using this=> String str[]=proFTPClientInterface.dir();
by (161k points)
Please post the code that is producing this output.
by (230 points)
please see the code.
public FTPFile getFileInfo(String path)throws IOException, FTPException, ParseException
    {
       
        System.setOut(printOut);
        System.out.println("inside getFileInfo...");
        //validation
        if(IBUtils.isEmpty(path))
            throw new IBRTException(IBExceptionConsts.MISSING_ARGS,"String path");
       
        if(sLog.isDebugEnabled())
            sLog.debug("getFileInfo: path="+path);

        FTPFile file=null;

        String os = proFTPClientInterface.system().toUpperCase();
        System.out.println("before if (os.indexOf(VMS)>-1)..."+os);
        if (os.indexOf("VMS")>-1)
            file = getFileInfoVMS(path);
       
        else
        {
            System.out.println("inside if (os.indexOf(VMS)>-1) else block...");
        String lastPart=path;
        String basePart=null;
        String lastPartFileName=null;
        int posFileName;
   
        int pos=Math.max(path.lastIndexOf("/"),path.lastIndexOf("\\"));
        System.out.println("inside  if (os.indexOf(VMS)>-1) else block...pos "+pos);
        if(pos!=-1)
        {
            lastPart=path.substring(pos+1);
            basePart=path.substring(0,pos);
            if(IBUtils.isEmpty(basePart) &&
                    (path.startsWith("/") || path.startsWith("\\")))
                basePart="/";
        }
        System.out.println("lastPart :"+lastPart);
        System.out.println("if (os.indexOf(VMS)>-1) else block.before proFTPClientInterface.dirDetails(basePart)");
        System.out.println("basePart :"+basePart);
        System.out.println("before chdir ");
        proFTPClientInterface.chdir(basePart);
        System.out.println("After chdir ");
        String str[]=proFTPClientInterface.dir();
        System.out.println("proFTPClientInterface.dir(basePart)  size:"+str);
       
        for(int i=0;i<str.length;i++)
        {
            System.out.println("Name :"+str[i]);
        }
       
       
        FTPFile[] files=proFTPClientInterface.dirDetails(basePart);
        System.out.println("afetr proFTPClientInterface.dirDetails(basePart) files.size"+files.length);
       
        for(int i=0,n=files.length;i<n;i++)
        {
            System.out.println("File Permission :"+files[i].getPermissions());
            lastPartFileName=getFileName(files[i].getName());
           
            System.out.println("in side for loop lastPartFileName "+lastPartFileName);
            if(lastPart.equalsIgnoreCase(lastPartFileName))
            {
                file=files[i];
                break;
            }
        }
        }
        System.out.println("end  getFileInfo file length "+file.size());
        return file;
    }

Please log in or register to answer this question.

Categories

...