Page 1 of 1

How to get file and folder count of the first level of a job folder

Posted: Tue Jul 05, 2011 5:41 pm
by Evan
Hello,



I'm looking to find a way to get the file and folder count of the first level of a Job folder to be able to assemble it back.



So if a job Folder contain 3 pdf and 2 folder, I want to be able to put "5" on my private data key (.NumFiles).



Actually "job.getFileCount()" don't work because it calculate all files excluding folder. Any Idea? Thanks!





function jobArrived( s : Switch, job : Job )

{

var InputJob = job.getPath();

var Filecount = job.getFileCount();

job.setPrivateData( "Ungroup.NumFiles", Filecount);

job.sendToSingle(InputJob);

}



How to get file and folder count of the first level of a job folder

Posted: Tue Jul 05, 2011 5:48 pm
by bens
Hi Evan,



try this:



var theDir = new Dir( job.getPath() );

var Filecount = theDir.entryList("*", Dir.Files | Dir.Dirs | Dir.NoDotAndDotDot, Dir.Unsorted ).length;

// ...


How to get file and folder count of the first level of a job folder

Posted: Tue Jul 05, 2011 6:22 pm
by Evan
Thanks Bens, it works.

Re: How to get file and folder count of the first level of a job folder

Posted: Wed May 24, 2017 8:56 pm
by gingrasj
Hi
users dropped a folder contains pdf and indd

Folder = XX_20170524
Subfolder = xx02regu20170524
FIles = XX_001.pdf, XX_001.indd ...... etc .... XX_048.pdf

48 pdf and 25 ind = 73 files

The sub folders are used later to rename stuff

The number of Indd file aren't equal to number of PDF

1 - Ungroup all file and keep Ungroup private data as well (it's automatic)
2 - Assemble files to merge. *
3 - Merge all PDF on one newspaper
4 - Send to FTP

* I need to Assembling PDF only (48) for merge, Schema id Ungroup, number of files is Ungroup.NumFiles but that number include indd files

How to find how many indd files (25) on specific job folder ? if possible I can just job.getPrivateData("Ungroup.NumFiles") - x; on Number of files

x = number of indesign file for the ungrouped job

Thanks
Jack