Good afternoon, tell me how you can send all the files to the server from the specified folder without implementing the file selection (roughly speaking, tell the program the name of the folder and everything there is to send to the server)? Note: the question how to send is implemented, it remains to where to pick up the files.

Closed due to the fact that the issue is too general for the participants Vladyslav Matviienko , zRrr , Kromster , cheops , user194374 Jun 23 '16 at 6:02 .

Please correct the question so that it describes the specific problem with sufficient detail to determine the appropriate answer. Do not ask a few questions at once. See “How to ask a good question?” For clarification. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • pick up all files from a folder and send one by one? - Andrew Bystrov
  • bother to explain what exactly you have not implemented? - Vladyslav Matviienko
  • 2
    And what exactly from this huge question you can not? You do not know which folder to take files from? You can not read them? Not sure how to get a list of files in a folder? Not sure how to send the file to the server? Not sure how to run a loop to send all files in sequence? - Vladyslav Matviienko
  • one
    Why don't you ask your questions then? Ticks them from you to pull, or what? - Vladyslav Matviienko
  • 2
    Possible duplicate question: sending a folder through socket - zRrr

1 answer 1

Don't know how to get a list of files in a folder?

Get a list of files from the folder:

File folder = new File("путь к вашей папке"); File[] listOfFiles = folder.listFiles(); // получить массив всех файлов в папке 

I do not know how to start a loop to send all the files in sequence?

Cycle to send:

 for(File f : listOfFiles ) { sendFile(f); //отправка файлов из списка поочередно. }