Page 1 of 1

Iterate over all files within a folder

PostPosted: Thu Jan 08, 2015 11:25 am
by Marc Schmitt
Hi there,

since the loader's file list feature isn't available anymore, what is a (conveniant) way to load all picture files in a folder (with different filenames - not a sequence), process them and save them out with a new filename (depended on the input filename)?

Any help would be greatly appreciated!

Cheers,
Marc

Re: Iterate over all files within a folder

PostPosted: Thu Jan 08, 2015 8:02 pm
by Sander de Regt
create an *.ifl and load that in the loader. Do the same with the saver only in a different directory.

Re: Iterate over all files within a folder

PostPosted: Fri Jan 09, 2015 12:38 pm
by Marc Schmitt
Great! Thanks!

I am trying to set up a workflow for inexperienced users for a very specific task. So, do you have a recommendation for a conveniant/easy/free(?) tool that can generate *.ifl? Maybe this is already possible via command line in windows?

Re: Iterate over all files within a folder

PostPosted: Fri Jan 09, 2015 5:31 pm
by Jiri Sindelar
Hi,
as Sander said, make a list of files. One way to do it is to run command line (cmd.exe), change to drive and path needed and make a list; for example:
Code: Select all
e:
cd e:\temp
dir /b *.jpg > filelist.ifl

to make a list of all jpeg files in e:\temp\

hth
Jirka

Re: Iterate over all files within a folder

PostPosted: Fri Jan 09, 2015 5:38 pm
by Jiri Sindelar
or make a batch file like this:
Code: Select all
cd %1
dir /b *.jpg > mylist.ifl


now you can drag a folder to that batch to create ifl

Re: Iterate over all files within a folder

PostPosted: Tue Jan 13, 2015 12:27 am
by Blazej Floch
Nice.
Here a suggestion (untested):

Code: Select all
@echo off
pushd %1

dir /on /b *.jpg *.png *.tga > %1.ifl || pause

popd

1. @echo off - only output sdtout/stderr
2. pushd - better of using this as it basically is a cd /d and makes no assuptions about the current directory.
3. You should be able to use mutiple extension if needed. This probably needs /on for proper sorting.
4. filename is folder name with ifl extension.
5. PAUSE screen in case of trouble.
6. pushd / popd - always go back to the original folder at the end - in case you call from a different batch file for example.

Re: Iterate over all files within a folder

PostPosted: Wed Jan 14, 2015 8:22 am
by Eric Westphal
Here's a Tool-Script I came up with some time ago.

Create a new file (say..."MakeIFL.eyeonscript") in [Fusion]\Scripts\Tool\ and paste the code.

Now drag any image-file from your directory onto Fusion's flow.
This will create a Loader, most likely loading only one single file.
(You can hold SHIFT while dragging the file in, to force Fusion to load just that file)

Then RMB on the Loader and select "Script->MakeIFL".

Code: Select all
-- create an IFL from a Loader's Clip, using all files in the directory
-- Must be run on a valid loader

myCompName = comp:GetAttrs().COMPS_FileName

myClip = tool.Clip[1]
myPath = eyeon.parseFilename(myClip).Path
myExt = eyeon.parseFilename(myClip).Extension
myName = eyeon.parseFilename(myClip).Name

print("----")

print(myPath)
print(myExt)
print(myCPath)

-- check if 'comp:' is used
if myCompName ~= "" then
   myCPath = eyeon.parseFilename(myCompName).Path   
   myPath = string.gsub(myPath, [[Comp:\]], myCPath)
end


myIFL = myPath..myName..[[_List.ifl]]

myCommand = [[dir ]]..myPath..[[*]]..myExt..[[ /b >]]..myIFL
print("Executing: "..myCommand)

os.execute(myCommand)

tool.Clip[1] = myIFL


Cheers.

Eric.