Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You should refactor your code so that the ftp commands are in functions and instead of copy/pasting those ftp commands everywhere, you have some flow like this:</p> <pre><code>String[] directories = ftpGetListing("ftp://myurl.com/mainfolder/"); String[] agents = Crawler.CrawlerDbUtils.getAllAgentIDs(); String[] combinedDirectories = getElementsInBothArray(directories, agents); String[] serverOnlyDirectories = getElementsOnlyInFirstArray(directories, agents); String[] agentOnlyDirectories = getElementsOnlyInFirstArray(agents, directories); // step 1: delete all server only directories ftpDeleteDirectories("ftp://myurl.com/mainfolder/", serverOnlyDirectories); // step 2: create all agent only directories ftpCreateDirectories("ftp://myurl.com/mainfolder/", agentOnlyDirectories); // step 3: depricate all files foreach(String dir in combinedDirectories) { String ftpDir = "ftp://myurl.com/mainfolder/" + dir + "/"; String[] serverFiles = ftpGetListing(ftpDir); String[] agentFiles = Crawler.CrawlerDbUtils.getAllPictures(dir); String[] serverOnlyFiles = getElementsOnlyInFirstArray(serverFiles, agentFiles); foreach(String file in serverOnlyFiles) { ftpDeleteFile(ftpDir + file); } } </code></pre> <p>Then you just have to implement really simple functions for <code>ftpGetListing</code>, <code>ftpDeleteDirectories</code>, <code>ftpCreateDirectories</code>, and <code>ftpDeleteFile</code>. Oh yeah and some simple array manipulation functions like: <code>getElementsInBothArrays</code> and <code>getElementsOnlyInFitstArray</code>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload