Created
August 31, 2010 15:30
-
-
Save mattkatz/559200 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//merging http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html | |
//and http://vafer.org/blog/20071112204524 | |
ftpClient = getConnectedFTPClient(); | |
public class GalleryLister{ | |
public FTPClient mFtp; | |
public ArrayList mAccumulator; | |
private String sep = "|"; | |
private String prefix = ""; | |
public GalleryLister(FTPClient ftp, ArrayList accumulator){ | |
mFtp = ftp; | |
mAccumulator = accumulator; | |
} | |
public final void traverse(FTPFile f) { | |
if(f.isDirectory()){ | |
prefix.concat(sep); | |
onDirectory(f); | |
//change to the directory | |
mFtp.changeWorkingDirectory(f.getName()); | |
final FTPFile[] children = mFtp.listFiles(); | |
for(FTPFile child : children){ | |
traverse(child); | |
} | |
//return to parent directory | |
mFtp.changeToParentDirectory(); | |
prefix = prefix.substring(1); | |
} | |
} | |
public void onDirectory(final FTPFile d){ | |
} | |
public void onFile(final FTPFile f){ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment