Mercurial > repos > rliterman > csp2
comparison CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/opt/bbmap-39.01-1/current/fileIO/CompressFiles.java @ 68:5028fdace37b
planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author | jpayne |
---|---|
date | Tue, 18 Mar 2025 16:23:26 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
67:0e9998148a16 | 68:5028fdace37b |
---|---|
1 package fileIO; | |
2 | |
3 import java.io.File; | |
4 | |
5 | |
6 public class CompressFiles { | |
7 | |
8 | |
9 public static void main(String[] args){ | |
10 for(String s : args){ | |
11 if(s.equalsIgnoreCase("zip")){ | |
12 zip=true; | |
13 gzip=false; | |
14 }else if(s.equalsIgnoreCase("gzip") || s.equalsIgnoreCase("gz")){ | |
15 zip=false; | |
16 gzip=true; | |
17 }else{ | |
18 compressFiles(s); | |
19 } | |
20 } | |
21 } | |
22 | |
23 | |
24 public static void compressFiles(String path){ | |
25 File f=new File(path); | |
26 compressFiles(f); | |
27 } | |
28 | |
29 public static void compressFiles(File path){ | |
30 | |
31 if(path.isDirectory()){ | |
32 File[] array=path.listFiles(); | |
33 for(File f : array){compressFiles(f);} | |
34 }else{ | |
35 compress(path); | |
36 } | |
37 | |
38 } | |
39 | |
40 public static void compress(File in){ | |
41 assert(in.exists()); | |
42 assert(in.isFile()); | |
43 String abs=in.getAbsolutePath(); | |
44 // System.out.println("Considering "+abs); | |
45 if(abs.endsWith(".gz") || abs.endsWith(".zip") || abs.endsWith(".bz2")){return;} | |
46 | |
47 // if(!abs.contains("custom_summary_") || !abs.endsWith("Gene_build36.txt")){return;} //TODO ***TEMPORARY*** | |
48 System.err.println(abs); | |
49 // if(!abs.endsWith(".gvla")){return;} //TODO ***TEMPORARY*** | |
50 // if(!abs.endsWith(".gvla") || | |
51 // !(abs.contains("seqGene") || abs.contains("refGene") || abs.contains("unionGene"))){return;} //TODO ***TEMPORARY*** | |
52 if(abs.toLowerCase().contains("familytree")){return;} //TODO ***TEMPORARY*** | |
53 | |
54 if(PRINT_7Z_BATCH){ | |
55 //-mx=4 is fast; -mx=5 or 6 is slow; 7+ is very slow. | |
56 // System.out.println("C:"+Data.SLASH+"\"Program Files\""+Data.SLASH+"7-Zip"+Data.SLASH+"7z a -mx=4 "+abs+".zip "+abs); | |
57 System.out.println("C:\\\"Program Files\"\\7-Zip\\7z a -mx=4 "+abs+".gz "+abs); | |
58 }else{ | |
59 System.out.println("Compressing "+abs+" to "+(zip ? "zip" : "gz")); | |
60 ReadWrite.copyFile(abs, abs+(zip ? ".zip" : ".gz")); | |
61 } | |
62 | |
63 } | |
64 | |
65 | |
66 public static boolean zip=true; | |
67 public static boolean gzip=!zip; | |
68 | |
69 public static boolean PRINT_7Z_BATCH=true; | |
70 | |
71 } |