Current position:  Home > Default > Folder containing Swedish characters isn't recognise. IsDirectory()

Folder containing Swedish characters isn't recognise. IsDirectory()

Time:December 10
Advertisement
Hello!
I have a problem with an application that is supposed to delete folders containing to files.
It works fine but a folders name contain Swedish charters the applications doesn't work
because that folder doesn't get recognizes as a directory by isDirectory().
public static boolean deleteDir(File dir) {
        if (dir.isDirectory())
            String[] children = dir.list();
            for (int i=0; i<children.length; i++)
                boolean success = deleteDir(new File(dir, children));
if (!success)
return false;
// The directory is now empty so delete it
return dir.delete();
Is there a way to get this work?
Help.
Best regards                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           
Advertisement
Bor0 wrote:
Hello!
I have a problem with an application that is supposed to delete folders containing to files.
It works fine but a folders name contain Swedish charters the applications doesn't work
because that folder doesn't get recognizes as a directory by isDirectory().Are you sure that that is the problem?
I created a folder named "Detta är ett katalognamn" and executed this code:
public class DirectoryTest {
    public static void main(String[] args) {
        String directoryName = "Detta är ett katalognamn";
        System.out.println("isDirectory: " + new File(directoryName).isDirectory());
}It prints:
isDirectory: true
Kaj