Skip to content
petermr edited this page Aug 1, 2020 · 4 revisions

#ami clean

Cleans ami CProject (deletes files).

picocli help 2020-08-01

Usage: ami clean [OPTIONS] <files>...
Description
===========
Cleans specific files or directories in project.
Accepts explicit paths or regular expressions.
ami clean -p /Users/pm286/workspace/tigr2ess --dir results cooccurrence
    deletes subdirectories results/ and cooccurrence/ in projcts tigr2ess
ami clean -p /Users/pm286/workspace/tigr2ess --file commonest.dataTables.html\
           count.dataTables.html entries.dataTables.html full.dataTables.html
    deletes 4 files by name

Parameters
=========
*     <files>...   Files to delete. Glob patterns are supported.
Options
=======
  -h, --help       Show this help message and exit.
  -V, --version    Print version information and exit.

conventions

See https://github.com/petermr/ami3/wiki/ami-_conventions for globbing.

examples

Source: https://github.com/petermr/ami3/blob/master/src/test/java/org/contentmine/ami/tools/AMICleanTest.java

delete all files of type

Test: org.contentmine.ami.tools.AMICleanTest.testCleanXML()

	/**
	 * tests cleaning XML files in a project
	 */
	public void testCleanXML() throws IOException {
		File targetDir = new File(TARGET_CLEAN, "oil5/");
		CMineTestFixtures.cleanAndCopyDir(OIL5, targetDir);
		
		List<File> files = new CMineGlobber().setGlob("**/*.xml").setLocation(targetDir).setRecurse(true).listFiles();
		Assert.assertEquals("xml files", 792, files.size());

		String args = " -vv "
			+ "-p " + targetDir
			+ " clean"
			+ " **/*.xml"
			;
		AMI.execute(args);
		
		files = new CMineGlobber().setGlob("**/*.xml").setLocation(targetDir).setRecurse(true).listFiles();
		Assert.assertEquals("xml files", 0, files.size());
	}

On the commandline this is:

cd <parent of target>
ami -vv -p target/clean/oil5 clean **/*.xml
Clone this wiki locally