Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
    Bookmark Topic Watch Topic
  • New Topic

Recursive FTP listing/making/creating/etc access

 
Koldo Urrutia
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello

Ive tried this over and over again (with about already 1000 lines of code) and it seems to fail at the last step....Hope you guys can help me.


I want to do the following:

I only have two functions right now: createfolder (Function A) and insertfile (Function B). Nothing else.

My requirements are the following:

Random number is a number common to function A and B
My main path is C:/ we base everything off that.
In C:/, we see if a folder called "webfolder" exists. If it does, we enter it. If it doesnt, we created it.
Once it is created and found, we enter it.

Function A: Counter is a local variable that equals 1. It is local to Function A. I make a folder with the current date and "" and the counter ONLY if there are less than 44 file inside this webfolder. If there is more than 44 files, I add one to a counter and then make a folder with the current date and the "" and the counter as long as it has less than 44 files inside. If not function A is repeated until counter is 9.

Once Function A is completed, I change to that that current date and "_" and the counter folder and inside make a folder with a random number.

Next, we have to insert some files into these folders. I once again start my path off C:/ then enter Webfolder (Webfolder at this point always exists because I call the folder creating function ALWAYS before inserting a file).

Function B: Counter is a local variable that equals 1. It is local to Function B. I search for a folder with the current date and "_" and the counter. If I find it, I search if it has less than 44 files inside. If it does have more 44, I add to counter plus one to look for the next folder which does (or doesnt) have more than 44 files.
If it doesnt, I insert a random number BMP inside of it.

Also if it doesnt, I create a folder with the name of random number, same as Function A. I go into that folder and create whatever file I pass to the function (most likely a file with the name of the random number I passed it).

Basically, I believe that it is.

Any questions, please ask. Ive been with this for about 3 weeks. The most I get is that it inserts everything correctly but transitioning between folder 1 of the date and folder 2, one folder/file set is lost.

Any help, thank you very much.
 
Koldo Urrutia
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Report post to moderator
This is my main:

 
fred rosenberger
lowercase baba
Bartender
Posts: 12123
30
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Koldo,

I'm sorry nobody here was able to help you. To be honest, I did read your original post, but found it hard to understand. It wasn't clear to me what you were trying to accomplish, or what the problem was.

You may want to read some of the item on our HowToAskQuestionsOnJavaRanch FAQ. These may help you get a better response the next time you have a question here. In particular, I'd suggest reading the articles AvoidRedHerrings and IsolateTheProblem.

Remember, when you ask a question here, the easier you make it for someone to help you, the more likely you are to get that help from them.
 
Koldo Urrutia
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Report post to moderator
fred rosenberger wrote:Hi Koldo,

I'm sorry nobody here was able to help you. To be honest, I did read your original post, but found it hard to understand. It wasn't clear to me what you were trying to accomplish, or what the problem was.

You may want to read some of the item on our HowToAskQuestionsOnJavaRanch FAQ. These may help you get a better response the next time you have a question here. In particular, I'd suggest reading the articles AvoidRedHerrings and IsolateTheProblem.

Remember, when you ask a question here, the easier you make it for someone to help you, the more likely you are to get that help from them.

Thank you for your good reply.

Well, Im not sure but what I was trying to accomplish was pretty on point to me. I tried to describe it with as much detail as possible. I even mentioned that if anyone had questions, please ask; I told members that please ask questions if they dont understand something.

I tried showing my main as a example of what my program does exactly. The problem was not there so maybe you are correct that I should have pointed that out.
 
    Bookmark Topic Watch Topic
  • New Topic