Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

count files in a folder

Engaged ,
Aug 16, 2012 Aug 16, 2012

I want to count the files in a volume. This will tell me how many pictures that i have then as certain actions happen it will automatically add them up for me. First step is finding the corect syntax for the items.

TOPICS
Scripting
1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2012 Aug 16, 2012

OK. This is what I am looking for

app.document.thumbnail.children

now I just have to count these little children.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 16, 2012 Aug 16, 2012

alert(app.document.thumbnail.children.length);

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2012 Aug 16, 2012

I ended up using this but I am sure its the same thing.

var myItems =app.document.thumbnail.children;

     for (var i=0; i<myItems.length; i++){}

         alert(i-2);

I am slowly plucking away at this calculator thing.

I am subtracting two because I have two pdf files I don't want to count.

Yep just tried it. It works.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 16, 2012 Aug 16, 2012

alert( app.document.visibleThumbnailsLength );

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 16, 2012 Aug 16, 2012

Nice. Very stealthy Mark I like it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Aug 16, 2012 Aug 16, 2012

The problem with the above methods is that they could be counting folders/text/exe files etc.

You can control what you want to count with something like this...

app.document.deselectAll();

alert(app.document.getSelection("jpg,pdf,tif").length);

The above will only count jpg, pdf and tif files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Aug 17, 2012 Aug 17, 2012

What was your intent with this script Bridge already has a built-in file type counter? My desktop is very tidy just now…!!!!

Screen shot 2012-08-17 at 12.12.01.png

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 17, 2012 Aug 17, 2012
LATEST

The intent is to inventory the images for each folder I view and inhance. There are multiple jpgs in the folder along with two pdfs a high and low res. The low res is droped to a hot folder after the low res pdf is droped the script would count the jpgs. Then when I move on to the next folder and do the same thing it adds it to my exsisting tally. Each time subtracting the two pdf files from the tally. Or if you can identify the jpgs you would not have to subtract.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines