Examples of SftpFile


Examples of com.sshtools.j2ssh.sftp.SftpFile

       
        //  Loop through all the returned values
        Iterator i = contents.iterator();
       
        while(i.hasNext()){
          SftpFile entry = (SftpFile)i.next();
         
          //  Ignores anything with a . or .. in it
          if(entry.getFilename().endsWith(".")) continue;

          //  Get the attributes for this directory item
          FileAttributes attrib = entry.getAttributes();
         
          //  Is it a directory or file? add it to the appropriate array
          if(attrib.isDirectory() == true && m_details.getRecurse() == true){
            folders.add(directory+entry.getFilename()+"/");
          }else{
            files.add(directory+entry.getFilename());
          }
        }
       
        return true;
      }catch(IOException e){
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

            {
                return cdup();
            }

            // Log.out("sftp path: "+tmp);
            SftpFile f = sftp.openDirectory(tmp);

            //Log.out("sftp after path...");
            //if(!f.isDirectory()) return false;
            sftp.closeFile(f);

            pwd = toSFTP(f.getAbsolutePath());

            //Log.debug("chdir: " + getPWD());
            if(refresh)
            {
                fireDirectoryUpdate();
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

    {
        try
        {
            String t = getPWD();

            SftpFile fx = sftp.openDirectory(t);

            //if(fx == null) System.out.println("Sftp: fx null");
            Vector v = new Vector();

            while(sftp.listChildren(fx, v) > 0)
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

            //System.out.println("downloadDir: " + dir + "," + out);
            fileCount = 0;
            shortProgress = true;
            baseFile = StringUtils.getDir(dir);

            SftpFile f2 = sftp.openDirectory(dir);

            Vector v = new Vector();

            while(sftp.listChildren(f2, v) > 0)
            {
                ;
            }

            String[] tmp = new String[v.size()];
            SftpFile[] f = new SftpFile[v.size()];
            Enumeration e = v.elements();
            int x = 0;

            while(e.hasMoreElements())
            {
                f[x] = ((SftpFile) e.nextElement());
                tmp[x] = f[x].getFilename();
                Log.debugRaw(".");

                if(f[x].isDirectory() && !tmp[x].endsWith("/"))
                {
                    tmp[x] = tmp[x] + "/";
                }

                //sftp.closeFile(f[x]);
                x++;
            }

            //sftp.closeFile(f2);
            File fx = new File(out);
            fx.mkdir();

            for(int i = 0; i < tmp.length; i++)
            {
                if(tmp[i].equals("./") || tmp[i].equals("../"))
                {
                    continue;
                }

                tmp[i] = tmp[i].replace('\\', '/');

                //System.out.println("1: " + dir+tmp[i] + ", " + out +tmp[i]);
                SftpFile f3 = sftp.openFile(dir + tmp[i], R);

                if(f3.isDirectory())
                {
                    if(!tmp[i].endsWith("/"))
                    {
                        tmp[i] = tmp[i] + "/";
                    }
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

        BufferedInputStream in = null;
        BufferedOutputStream out = null;

        try
        {
            SftpFile inf = null;
            SftpFile of = null;
            boolean outflag = false;

            if(up)
            {
                in = new BufferedInputStream(new FileInputStream(file));
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

        try
        {
            oldName = toSFTP(oldName);
            newName = toSFTP(newName);

            SftpFile f = sftp.openFile(oldName, RW);
            f.rename(newName);

            return true;
        }
        catch(Exception ex)
        {
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

        try
        {
            file = toSFTP(file);

            SftpFile of = sftp.openFile(file, RW);

            //of.delete();
            //of = sftp.openFile(file, RW); 
            sftp.changePermissions(of, "rwxr--r--");
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

    {
        try
        {
            file = toSFTP(file);

            SftpFile inf = sftp.openFile(file, R);

            return new SftpFileInputStream(inf);
        }
        catch(IOException ex)
        {
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

    {
        file = toSFTP(file);

        try
        {
            SftpFile f;

            if(!file.endsWith("/"))
            {
                Log.out(">>>>>>>> remove file: " + file);
                f = sftp.openFile(file, RW);
View Full Code Here

Examples of com.sshtools.j2ssh.sftp.SftpFile

            if(tmp[i].equals("./") || tmp[i].equals("../"))
            {
                continue;
            }

            SftpFile f3;

            //System.out.println(dir+tmp[i]);
            if(tmp[i].endsWith("/"))
            {
                f3 = sftp.openDirectory(dir + tmp[i]);
            }
            else
            {
                f3 = sftp.openFile(dir + tmp[i], RW);
            }

            Log.out(">>>>>>>> remove file/dir: " + dir + tmp[i]);

            if(f3.isDirectory())
            {
                cleanSftpDir(dir + tmp[i], f3);

                //sftp.closeFile(f3);
                sftp.removeDirectory(dir + tmp[i]);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.