Copiar vínculo al Portapapeles
Copiado
Hi
I need a script that move files to a folder with the same name as the first 8 characters of the file name, that has to be moved. If the folder doesn't exist, it has to be created. I'm new in Javascript! Can anybody help me??
thanx
...function createFolder(file) {
var parentFolder = file.parent;
var saveFolder = new Folder( parentFolder + '/' + file.name.substring( 0, 8 ) );
if( !saveFolder.exists ) saveFolder.create();
var saveFile = new File( saveFolder + '/' + file.name);
if( file.copy( saveFile ) ) file.remove();
}function main() {
var folder = new Folder("~/Desktop/images");
var files = folder.getFiles();
for (var i = 0; i < files.length; i++) {
var f = files;
if (f instanceof File) {
createFolder(
Copiar vínculo al Portapapeles
Copiado
Need more details. Where are the files now? Where do you want the new folder? etc
Copiar vínculo al Portapapeles
Copiado
The files are placed in a folder by a workflow. The new folder can be a subfolder to the workflow output folder, where the files where picked up. But that's not the major issue, I can change the path, if it is needed.
Copiar vínculo al Portapapeles
Copiado
var file = new File( '/c/temp4/SLIP762011.jpg' );
var parentFolder = file.parent;
var saveFolder = new Folder( parentFolder + '/' + file.name.substring( 0, 8 ) );
if( !saveFolder.exists ) saveFolder.create();
var saveFile = new File( saveFolder + '/' + file.name);
if( file.copy( saveFile ) ) file.remove();
Copiar vínculo al Portapapeles
Copiado
Hi Michael
This is very close, but I need to pick up every file in a specific folder (hotfolder), not just one file. Is this posible?
Copiar vínculo al Portapapeles
Copiado
function createFolder(file) {
var parentFolder = file.parent;
var saveFolder = new Folder( parentFolder + '/' + file.name.substring( 0, 8 ) );
if( !saveFolder.exists ) saveFolder.create();
var saveFile = new File( saveFolder + '/' + file.name);
if( file.copy( saveFile ) ) file.remove();
}function main() {
var folder = new Folder("~/Desktop/images");
var files = folder.getFiles();
for (var i = 0; i < files.length; i++) {
var f = files;
if (f instanceof File) {
createFolder(f);
}
}
};
main();
Something like that should work.
Copiar vínculo al Portapapeles
Copiado
This couldn't been any better, a lot of thanks from here.
Encuentra más inspiración, eventos y recursos en la nueva comunidad de Adobe
Explorar ahora