Example 2

Pre-process Java source files from the src directory hierarchy. Put the resulting files in a directory hierarchy under src_pp.

JavaScript

new RecursiveProcessTF(). addSource(new DirectoryAndFilter(src, new EFileNameExtensionFilter("java"))). setTarget(src_pp). setTaskFactory( new TextReplaceTF(). addReplace("!!!VERSION!!!", "1.0")).run();

Example 3

Move Java source files from the src directory hierarchy to the src2 hierarchy. Change their file name extensions to txt.

JavaScript

new RecursiveProcessTF(). addSource(new DirectoryAndFilter(src, new EFileNameExtensionFilter("java"))). setTarget(src2). setTargetStrategy( new ChangeExtensionTargetStrategy(). putExtensionTranslation("java", "txt")). setTaskFactory( new MoveTF()).run();

Example 4

Move all text files from the src directory hierarchy to the doc directory hierarchy. Change their file names to be in upper case.

JavaScript

new RecursiveProcessTF(). addSource( new DirectoryAndFilter( src, new EFileNameExtensionFilter("txt", false))). setTarget(doc). // Use a closure to calculate the target location setTargetStrategy(function(source, baseDir, relLoc) { return new FutureFile( baseDir, relLoc.getParentLocation().getChildLocation( relLoc.getName().toUpperCase())); }). setTaskFactory( new MoveTF()).run();

JRuby

# Use a lambda function for target strategy Schmant::RecursiveProcessTF.new. addSource( Schmant::DirectoryAndFilter.new( $src, Schmant::EFileNameExtensionFilter.new("txt", false))). setTarget($doc). setTargetStrategy( lambda { |source, baseDir, relLoc| Schmant::FutureFile.new( baseDir, relLoc.parentLocation.getChildLocation( relLoc.name.upcase)) } ). setTaskFactory( Schmant::MoveTF.new).run

Jython

# Use a lambda function for target strategy RecursiveProcessTF(). \ addSource( DirectoryAndFilter( src, \ EFileNameExtensionFilter("txt", False))). \ setTarget(doc). \ setTargetStrategy( lambda source, baseDir, relLoc: FutureFile( \ baseDir, \ relLoc.getParentLocation().getChildLocation( \ relLoc.getName().upper()))). \ setTaskFactory( MoveTF()).run();


* An EntityFS-aware task is implemented using EntityFS. This means that it uses the filter settings of DirectoryView:s and also that it often can work with other file system implementations than File-based, such as the RAM file system.