Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void moveWritableTxtFiles(String from, String to) throws IOException {
- File f = new File(from);
- File t = new File(to);
- if(!t.exists())
- {
- t.mkdir();
- }
- if(f.exists()){
- File files[] = f.listFiles();
- for (File file : files) {
- if(file.getName().endsWith(".txt"))
- {
- if(file.canWrite() && t.canWrite())
- {
- System.out.println(file.getName());
- System.out.println(file.renameTo(new File(t.getPath().toString()+"\\"+file.getName())));
- }
- }
- }
- }
- else {
- System.out.println("Ne postoi");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement