Quote:
Originally Posted by KlaraBlik
... I would like to move only certain file types (e.g. .mp3) after successful extraction to a new folder. How do I have to amend this script?
|
This script will preserver folder structure. To move all the files to a single folder you can also just use a packagizer rule.
Code:
/*
Move extracted files
Trigger: Archive extraction finished
*/
var source = "C:\\Downloads";
var destination = "C:\\Finished";
var fileTypes = ["mp3", "ex1", "ex2"];
archive.extractedFilePaths.forEach(function(filePath) {
if (fileTypes.indexOf(filePath.extension) > -1) {
var newFolder = filePath.parent.toString().replace(source, destination);
filePath.moveTo(newFolder);
}
})