I have a folder containing files/pictures (under windows 7) displayed as large icons in an ascendent order like picture_a.png, picture_b.png and picture_c.png.
Using the code bellow I would like to ensure that these files/pictures names will be copied into the varaiable s in the same order than they are in the folder.
Thanks in advance for your help,
However if you want to sort the files in alphabetical order by their names, you could certainly do that. That's what your example looked like. So is that what you actually want to do?
Paul Clapham wrote:However if you want to sort the files in alphabetical order by their names, you could certainly do that. That's what your example looked like. So is that what you actually want to do?
Yes, exactly since at some points in a loop of the code I would like to delete the files/pictures one by one from the folder once each of the file/picture has been processed.
I've tried the code below but I obtain an error :
If you don't understand what it's trying to tell you -- which is a perfectly normal thing to happen to a beginner -- then you can certainly ask that here. But "I obtain an error" isn't a good way to ask that, because we don't know what the error says. And it's important to read the error message.
Jon Hedge wrote:The error was just highlighted in the IDE since I did not build the code. The error message (after building) is the following :
error: cannot find symbol
sorted_s = sort(s);
symbol: method sort(String)
It's looking for a method named "sort". You have not provided this method. If you are expecting to use a sort method available in the Java library you'll have to look up which class it is in and invoke it according to the documentation. You might see if the Arrays class has anything to offer.