Majstr Miha wrote:So the first problem apperas, right at the begginig. I don't know how to start. How can I make my program "communicate" with USB drive (to read free space, copy files,...)?
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Majstr Miha wrote:Oh, right. I should just run this method for every subfolder I find ;)....doing that right now.
The method is endsWith() I believe?
Joanne
Joanne Neal wrote:
Majstr Miha wrote:Oh, right. I should just run this method for every subfolder I find ;)....doing that right now.
The method is endsWith() I believe?
There is a better way to do this. Have a look at the overloaded versions of the File.listFiles() method.
Majstr Miha wrote:Yes, I have looked there but I don't know how that could help me? I already have a way to scan a folder for files and crate a list of MP3s
Majstr Miha wrote:but I can't figure out how to make the same code run throught all subfolders, that it finds?
Joanne
Joanne Neal wrote:
Majstr Miha wrote:Yes, I have looked there but I don't know how that could help me? I already have a way to scan a folder for files and crate a list of MP3s
Yes. And while there's nothing inherently wrong with how you've done it, the standard object-oriented way to search for specific files is to use the File.listFiles methods that accept either a FileFilter or FilenameFilter instance as a parameter.
Joanne Neal wrote:
Majstr Miha wrote:but I can't figure out how to make the same code run throught all subfolders, that it finds?
Well one way is to write a method that accepts a directory as a parameter, searches through that directory, procesing any files it finds however it needs to and calls itself recursively for any sub-directories it finds.
Majstr Miha wrote:But isn't this just what I have done? I have a method called "Iskanje" that accepts directory as parameter, and then with for loop I try to use this method on every subfolder that is found the first time when method executes. But it only gives me a list of mp3's in first folder, and lists a subfolder in that folder, but it doesn't search further through that subfolder?
Majstr Miha wrote:
I don't know how to pass one of this values to Copy method correctly?