Looking for away to Copy or Move a folder in your Titanium app? Check out Dossier an all JavaScript module that provides a cross-platform API for working with folders.
Where to get it
The Dossier module, example app.js and supporting files are available at https://github.com/benbahrenburg/Dossier
How it works
Dossier is all JavaScript making it simple to both use and modify. Simply copy the dossier.js CommonJS module into your app and start coding.
Below is a sample app.js showing Dossier in action.
//Create our application namespace var my = {}; //Import the module my.dossier = require('dossier'); Ti.API.info('Copy one directory to another'); //Create our source and target directory paths var sourceDir = Ti.Filesystem.getFile(Ti.Filesystem.resourcesDirectory, 'SampleData'); var targetDir = Ti.Filesystem.getFile(Ti.Filesystem.applicationDataDirectory + '/NewSampleData'); Ti.API.info('Copying ' + sourceDir.nativePath + ' to ' + targetDir.nativePath ); my.dossier.copy(sourceDir.nativePath,targetDir.nativePath); Ti.API.info('List all the contents of ' + targetDir.nativePath); var listTargetContents = my.dossier.listContents(targetDir.nativePath); Ti.API.info('Move ' + sourceDir.nativePath + ' to ' + targetDir.nativePath ); my.dossier.move(sourceDir.nativePath,targetDir.nativePath); Ti.API.info('List all the contents of ' + targetDir.nativePath); listTargetContents = my.dossier.listContents(targetDir.nativePath);