Delete all files with an extension using Java

后端 未结 5 1386
自闭症患者
自闭症患者 2021-02-15 11:52

I\'m (relatively) new to Java and I\'m trying to implement a .jar that runs a list of commands that in Windows XP\'s command prompt it would be:

cd\\
cd myfolder         


        
5条回答
  •  忘掉有多难
    2021-02-15 12:45

    You are using Collection method get on an Array. Use Array Index notation as below:

            File pes = fList[i];
    

    Also better to use endsWith() String method over the file name as:

       if (pes.getName().endsWith(".lck")){
          ...
       }
    

提交回复
热议问题