Copy files on hard drive throught script code
Hi guys,
i have an array populated with media that i would like to copy in another folders on hard drive. Is possible throught scripting to copy files on disk?
Thank you
Hi guys,
i have an array populated with media that i would like to copy in another folders on hard drive. Is possible throught scripting to copy files on disk?
Thank you
Yes, if your CEP panel has Node.js enabled, you can copy files with fs.copyFile() or fs.copyFileSync()
var fs = require('fs');
// Sync Method
fs.copyFileSync(sourcePath, destinationPath);
// Async Method
fs.copyFile(sourcePath, destinationPath, function(err){
if (err) throw err;
console.log('File Copied');});
If you're looking for an ExtendScript solution, you can use file.copy() on a file object.
var myFile = new File(pathToFile);
myFile.copy(pathToNewFile);
Node.js is typically faster if you can use that method.
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.