fist issue
This commit is contained in:
parent
726c4ab942
commit
7ad7631cd2
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
@ -1,16 +1,11 @@
|
|||
# ---> Java
|
||||
# Compiled class file
|
||||
# Java
|
||||
target/
|
||||
bin/
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
|
|
@ -20,7 +15,5 @@
|
|||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
# do NOT ignores
|
||||
!lib/*
|
||||
|
|
|
|||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>desktopCleanLibraryFilesFromCreo</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
package se.mmk.app;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class LibraryFileCleaner {
|
||||
String newDirectory;
|
||||
String currentWd;
|
||||
|
||||
public static void main(String[] args) {
|
||||
new LibraryFileCleaner().run();
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
currentWd = Paths.get(".").toAbsolutePath().normalize().toString();
|
||||
|
||||
List<String> libFileNames = getLibraryFileNames();
|
||||
|
||||
removeFiles(libFileNames);
|
||||
}
|
||||
catch (Exception e) {
|
||||
//...
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getLibraryFileNames() throws IOException{
|
||||
List<String> fileNames = new ArrayList<>();
|
||||
|
||||
FileReader fReader = new FileReader(new File("C:\\Creo_Export\\Creo6-Setting\\Others\\LibraryFiles.txt"));
|
||||
BufferedReader bReader = new BufferedReader(fReader);
|
||||
|
||||
String line = bReader.readLine();
|
||||
|
||||
while (!line.isEmpty()) {
|
||||
String fName = line.toString().substring(line.toString().lastIndexOf('\\'));
|
||||
|
||||
if(fName.length() < 2)
|
||||
continue;
|
||||
|
||||
fileNames.add(fName.substring(2));
|
||||
|
||||
line = bReader.readLine();
|
||||
if(line == null)
|
||||
break;
|
||||
}
|
||||
bReader.close();
|
||||
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
private void removeFiles(List<String> libFileNames) {
|
||||
File wdPath = new File(currentWd);
|
||||
|
||||
Arrays.asList(wdPath.listFiles()).forEach(f->{
|
||||
if(f.isFile()) {
|
||||
for (String fName : libFileNames) {
|
||||
if(f.getName().contains(fName)) {
|
||||
f.delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue