Community Forums Archive

Go Back

Subject:processing files in subfolders?
Posted by: garrigus
Date:10/15/2007 6:57:27 PM

Is it possible to specify a folder and then process all files in that folder as well as all subfolders?

Scott

Subject:RE: processing files in subfolders?
Reply by: _TJ
Date:10/16/2007 12:12:58 PM

You can't do this with Batch Converter (it doesn't do subfolders of subfolders). But you can do this easily with a script.

Have a look at the script "Generic Script to process files in a folder", currently #83 in your hymnal.

tj

Subject:RE: processing files in subfolders?
Reply by: garrigus
Date:10/17/2007 4:27:08 PM

Hi TJ,

Thanks for the info... I checked out that script, but it only processes the files in the selected folder. It doesn't process the subfolders. What changes do I need to make in order for it to process subfolders as well?

Thanks!
Scott

Subject:RE: processing files in subfolders?
Reply by: ForumAdmin
Date:10/18/2007 7:28:38 AM

You could recurse on Directory.GetDirectories, but I had a hunch that the runtime would now do this for you. A quick check of MSDN proved me right.

Change this:

foreach (string strFilename in Directory.GetFiles(strFolder, "*.wav"))

to this:

foreach (string strFilename in Directory.GetFiles(strFolder, "*.wav", SearchOption.AllDirectories))


This is only available in .NET 2.0 or later. So if you need it to work in Forge 8.0, you'll have to write your own.

J.

Message last edited on10/18/2007 7:42:48 AM byForumAdmin.
Subject:RE: processing files in subfolders?
Reply by: garrigus
Date:10/18/2007 8:02:30 AM

Hi J.

Oh... that's just beautiful. Thanks very much!

I appreciate all your and TJ's help...

Scott

Go Back