1 package org.unicode.cldr.tool; 2 3 import com.google.common.collect.ImmutableSet; 4 import com.google.common.io.Files; 5 import java.io.File; 6 import java.io.IOException; 7 import java.util.Set; 8 import org.unicode.cldr.util.CLDRPaths; 9 10 public class CopyNewEmoji { main(String[] args)11 public static void main(String[] args) throws IOException { 12 File targetDir = new File(CLDRPaths.APPS_EMOJI_DIRECTORY); 13 14 // TODO make this a command argument 15 File sourceDir = new File(CLDRPaths.CLDR_PRIVATE_DIRECTORY + "new_emoji"); 16 17 System.out.println( 18 "sourceDir: " 19 + sourceDir 20 + "; isDirectory(), exists(): " 21 + sourceDir.isDirectory() 22 + ", " 23 + sourceDir.exists()); 24 System.out.println( 25 "targetDir: " 26 + targetDir 27 + "; isDirectory(), exists(): " 28 + targetDir.isDirectory() 29 + ", " 30 + targetDir.exists()); 31 32 final String[] sourceList = sourceDir.list(); 33 final String[] targetList = targetDir.list(); 34 35 Set<String> sourceFiles = ImmutableSet.copyOf(sourceList); 36 Set<String> targetFiles = ImmutableSet.copyOf(targetList); 37 38 System.out.println("sourceFiles: " + sourceFiles.size()); 39 System.out.println("targetFiles: " + targetFiles.size()); 40 41 for (String sourceFile : sourceList) { 42 if (!targetFiles.contains(sourceFile)) { 43 Files.move(new File(sourceDir, sourceFile), new File(targetDir, sourceFile)); 44 System.out.println(sourceFile + " => " + targetDir); 45 } 46 } 47 } 48 } 49