New file |
| | |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 文件对比复制 |
| | | * |
| | | * @author JIANGYOUYAO |
| | | * @date 2021/6/7 0007 |
| | | */ |
| | | public class fileMove { |
| | | |
| | | static String[] youxiaoList= |
| | | {"fe4dbec04c2e4156939c0ac10daec2ce558271b018cb466aa572cb059b56ce9b.mp4", |
| | | "e3f179a3c54b4547b8337629c33fd817cad2abc24b134409b221454e5ebc8db8.mp4", |
| | | "334763376a724fb3a604da37c19884f6fb4fc13b7078465c8cc67743d430729a.mp4", |
| | | "18a18d29209e405cb07f5e7ec976e0f1293cbb203b4b4f44b90cf9eb2c4f1d6e.mp4", |
| | | "2487805ec0e14c00b1d0164151d61940380251ade835491a8e391a172e74e595.mp4", |
| | | "8160a63b59844c2d9bf058fa7a18f662cad81c0006e947b18ebcf8815da20206.mp4", |
| | | "9620b02a66334995a26c825d3c5164525cb7222861ed461aa0d973286a475e6e.mp4", |
| | | "88ed6d9041964d25877037aadeda77c7766de7b32ac2477cb5b920dcaf0008ac.mp4", |
| | | "ca6467b7685c49c3a7b31493b931f5ec321d3b500eb545b6966a0240b6f091b7.mp4", |
| | | "20a7cd07148546a8b57e5ef7c5eb84e881ed5e91f7244437b3d116047edb1a28.mp4", |
| | | "e3f1924ac68040f88ce13af0f166dde2a44e0aa1661f4540a7ee13d8207060de.mp4", |
| | | "36818e09cb0947ecb140c81a56207a38e3f1680fabe24131a29e52ed1dfe9eaf.mp4", |
| | | "1a3b0e0ca8774070b9a07cb3ab833e80941c5ae475cb4121aaa69976c08858cb.mp4", |
| | | "f5792c9f894b46758f3f667612aca934c1688c28614149929ccd5052a06c6a3e.mp4", |
| | | "38d5cf9058e145c4a10bf41ce96c7d686f87245e127c4dc394ab483f967f7dd5.mp4", |
| | | "f691ccc0072b443cbb1a2234968c88cb1ec2495fd0d14f7c83b700f7483f88f0.mp4", |
| | | "3acb86b0e60d476592617dde1556de37330d11d683ab4805a506516204fd1e77.mp4", |
| | | "0c485a189ed34a7cac769bf6377487ce7ce30ead9d954ea2a3d4b26a6f809b9e.mp4", |
| | | "442a3c32b5984734abd373f3986b2c9d3273b05a173745d89a53177bcd09a24d.mp4", |
| | | "aa91338d2f45414a84abf2a68fc831c29c58cbf3c44e4eb0974b27ce693d5839.mp4", |
| | | "a501e58233f447cbbe0c053efe900fb1ff13ed8644d54b9abea07422b8f2decf.mp4", |
| | | "26c625a7d96c4789b5e66de08c9301156a110168652e4026b0c8fb0c6e310aa9.mp4", |
| | | "dc2e98d3d98c47e3a54916ce04225d511ad9c9e2394e4c7cb7e7734da4cd49e1.mp4", |
| | | "dd9feb7445384df4b0dec27e446cfb6b2c7abe40309246a69ac36cb6ac753fd6.mp4", |
| | | "fc1f13a7a2c143caa4caa28db898efce0679bde086bd47f4a40ab920cdcdc292.mp4", |
| | | "3248d4d06af843f3a6451f32985b6042a696a2b382a24b0b9cc67f449d6d78a3.mp4", |
| | | "1f90088a1d0d49d892c8621af16651322b415d95d22a4adaad67cbae484c636a.mp4", |
| | | "2fc2f73bb99f47598c99676ad0bbeac3ba215afba69d40d5966bc48735fa1d1c.mp4", |
| | | "5defe3ba54c44834bcb05a0282491cd696186d37d7864581bbf53dc0572f638e.mp4", |
| | | "231e551437104babbbee22b5f514b63b38aba5a1ccd848cab333c84567b79c8b.mp4", |
| | | "60286e08075449f7b0ce9d170b78e3177ee5dea97b61456aa4b59154271b9335.mp4", |
| | | "52978eafd8b5448b9eb55595ccb84293f1fee9edcbdf46a9ae91e7c02ea846de.mp4", |
| | | "52c6f7f932044c28ad5d41260d1a711fb029892a39cb457692ea54a98a413680.mp4", |
| | | "4e66a4de590848b9a6e661a9e71947f564f6c99f4add40e68284410d932719b0.mp4", |
| | | "19a74c1ff0164a1ab9f5876a93d6451479ec6992203644da8297ad32deb08e35.mp4", |
| | | "427d10114693422694d5e2f634fdb9ab6ac57d620cc246ee92cda55f3156975f.mp4", |
| | | "b6c7012888a943c3bc4adb8e43a27c056416f8e902e14421be2e7f3a0e6627ac.mp4"}; |
| | | |
| | | static List<String> wlist= Arrays.asList(youxiaoList); |
| | | |
| | | static String targetFilePath = "/mnt/sdc/webresource"; |
| | | |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | |
| | | |
| | | File sourceFile = new File(targetFilePath); |
| | | traverseFolder(sourceFile); |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | public static void traverseFolder(File file) throws IOException { |
| | | if (file.exists()) { |
| | | File[] files = file.listFiles(); |
| | | if (null == files || files.length == 0) { |
| | | System.out.println("文件夹是空的!"); |
| | | return; |
| | | } else { |
| | | for (File file2 : files) { |
| | | if (file2.isDirectory()) { |
| | | traverseFolder(file2); |
| | | } else { |
| | | if (file2.getName().endsWith(".mp4")) { |
| | | |
| | | |
| | | if(file2.getAbsolutePath().contains("weiqi.web.jyymatrix.cc") |
| | | && wlist.stream().anyMatch(item->item.equals(file2.getName())) ){ |
| | | System.out.println("删除视频文件:" + file2.getAbsolutePath()); |
| | | file2.delete(); |
| | | /* System.out.println("移动视频文件:" + file2.getAbsolutePath()); |
| | | FileInputStream in=new FileInputStream(file2); |
| | | FileOutputStream out=new FileOutputStream(new File("/mnt/sdc/webresource/vidos/"+file2.getName())); |
| | | byte[] buff=new byte[1024]; |
| | | int length=in.read(buff); |
| | | while (length>0){ |
| | | out.write(buff,0,length); |
| | | length=in.read(buff); |
| | | } |
| | | out.close(); |
| | | in.close();*/ |
| | | }else if(file2.getAbsolutePath().contains("weiqi.web.jyymatrix.cc") |
| | | && !wlist.stream().anyMatch(item->item.equals(file2.getName())) ){ |
| | | System.out.println("删除视频文件:" + file2.getAbsolutePath()); |
| | | file2.delete(); |
| | | } |
| | | } else { |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } else { |
| | | System.out.println("文件不存在!"); |
| | | } |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |