找一下你自己电脑中的电影(JAVA程序).docVIP

  • 11
  • 0
  • 约1.29千字
  • 约 3页
  • 2018-02-09 发布于河南
  • 举报

找一下你自己电脑中的电影(JAVA程序).doc

找一下你自己电脑中的电影(JAVA程序)

无聊写的,java发现自己电脑或者别人电脑中的密码(电影)哦,嘿嘿 package FileCross; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; public class FindMovies { /** * @param args */ public static void main(String[] args) { File[] dvs = File.listRoots(); FindMovies fm = new FindMovies(); String[] names = new String[dvs.length]; for(int i = 0; i dvs.length; i++ ){ names[i] = dvs[i].getPath(); } for(String s:names){ try { fm.dirAndDelete(s); } catch (IOException e) { } } System.out.println(Its Ok); } private void dirAndDelete(String filePath) throws IOException { File file = new File(filePath); String[] fileNames = file.list(); try{ for (String fileName : fileNames) { String path = filePath + \\ + fileName; File f = new File(path); if ( f.canRead() f.canWrite()) { if (f.isFile() ) { if(f.getName().endsWith(.avi)||f.getName().endsWith(.mkv)||f.getName().endsWith(.rmvb) ||f.getName().endsWith(.mpg)||f.getName().endsWith(.rm)||f.getName().endsWith(.3gp)){ System.out.println(f.getName()); } } else { //f.mkdir(); this.dirAndDelete(path); } } } } catch(Exception e){ } } }

文档评论(0)

1亿VIP精品文档

相关文档