wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Recursive FTP listing/making/creating/etc access Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Recursive FTP listing/making/creating/etc access

Koldo Urrutia
Ranch Hand

Joined: Dec 16, 2011
Posts: 85
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

Joined: Dec 16, 2011
Posts: 85
This is my main:

fred rosenberger
lowercase baba
Bartender

Joined: Oct 02, 2003
Posts: 11150
    
  16

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.


There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Koldo Urrutia
Ranch Hand

Joined: Dec 16, 2011
Posts: 85
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Recursive FTP listing/making/creating/etc access
 
Similar Threads
Using the Random Method: How to use random numbers to represent other values?
File not found as class resource in jar...
Test 252: Mock exam
Reading and Writing from Large File, OutOfMemory
Populating A Folder With Files - Access Denied