不存在的文件不断出现

时间:2017-10-05 18:27:03

标签: java file

我正在编写一个程序,我根据包含路径的文件备份一堆文件夹和文件。当我打开文件时,问题就出现了,我一直在寻找"我的音乐"在文件中。从我所看到的内容中不存在此文件。我通过cmd检查并查看了其他地方,但它不断出现。我已经尝试了file.exists,得到了它,当我尝试列出其中的内容时,我从中获得nullPointer不存在。 `

public static void enterFolder(String path, String runningPath) throws IOException {
        //opens folder
        File f = new File(path);
        //check to see if folder exists I check in debug
        boolean food = f.exists();
        //get an array of the stuff inside
        File[] list = f.listFiles();
        DataOutputStream output;
        DataInputStream input;
        input = new DataInputStream(connection.getInputStream());
        output = new DataOutputStream(connection.getOutputStream());

        //loops through what is inside breaks here with nullPointer because list uninitialized
        for (int i = 0; i < list.length; i++) { `

路径 C:\ Users \ Tallennar \ Documents \ My Music

runningPath C:\ Users \ Tallennar \ Documents \ My Music

1 个答案:

答案 0 :(得分:0)

经过大量研究后,My Music文件夹是Windows的目录连接点。这样XP程序就可以与更新版本的Windows兼容。我的解决方案是删除这些文件,因为我个人没有任何来自XP的程序。我如何删除它们是我进入文件资源管理器的视图选项卡中的选项。然后,我在选项的视图选项卡中取消选中隐藏系统文件。然后,我突出显示了文件并将其删除,并将选项设置恢复正​​常。

链接到XP联结信息: Phantom Folder Info

相关问题