Update : Move files from one folder to another based on file extension

后端 未结 3 1255
耶瑟儿~
耶瑟儿~ 2021-01-25 12:46

Situation:

I am doing an automation where I have to download only CSV files from a set of files. And now i want to move only CSV files from one folder t

3条回答
  •  一整个雨季
    2021-01-25 12:53

    You can simply move the file this way.

    import java.io.IOException;
    import java.nio.file.Files;
    import java.nio.file.Paths;
    
    public class MyFilteredFileList {
    
        public static void main(String a[]){
            try {
                Files.move (Paths.get("C:\\Users\\sh370472\\Downloads\\file.txt"),
                Paths.get("E:\\Query\\file.txt"));
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    

提交回复
热议问题