Skip to main content
Inspiring
November 3, 2022
Question

Get only First File in a folder without going thru all the files.

  • November 3, 2022
  • 2 replies
  • 172 views

Hi there,

I have a multiple image sequences  folders with  over 20K images in each folder. I just want to get path of first image or any one image from each folder. Ex. "path\to\folder\name_00000.jpg". 


Note first image always contains "_00000".

 

Folder.getFiles()[0] is too too slow to read all files first in folder and then take first one.

 

what might be the other way to instantly get any one file from folder?

This topic has been closed for replies.

2 replies

ShiveringCactus
Community Expert
Community Expert
November 4, 2022

If there's no scripting way to do this, could you instead just use the image sequence, but put a time remap / frame hold on it to only show the first frame?  A little ugly, but it would get you there.

Mylenium
Legend
November 3, 2022

You could probably construct a convoluted loop that builds an URI in the file system object and simply returns a true/ false for a file being there, but outside that scripts simply apparently can't do what AE can't since they use the interanl functions. In the past peopel also created Python Applets or little VBS scripts via Windows Scripting host to do such jobs and simply write out text files or send data to a socket connection to talk to AE scripts to avoid the limitations.

 

Mylenium