Enhancement - GetFileList - Allow Search in Subdirectories

Ideas for new features & functions

Moderators: Dorian (MJT support), JRL

Post Reply
sailor dude
Pro Scripter
Posts: 50
Joined: Fri Jan 20, 2006 10:43 pm

Enhancement - GetFileList - Allow Search in Subdirectories

Post by sailor dude » Mon May 14, 2007 9:14 pm

Please allow search for files in subdirectories.

You could create a GFL_SUB system variable for this

kpassaur
Automation Wizard
Posts: 696
Joined: Wed Jul 07, 2004 1:55 pm

Get file list enhancement

Post by kpassaur » Tue May 15, 2007 3:49 pm

That would be a very nice feature. Currently I get a directory list and then go through each directory with GetFileList

sailor dude
Pro Scripter
Posts: 50
Joined: Fri Jan 20, 2006 10:43 pm

Get File List - Directories

Post by sailor dude » Wed May 16, 2007 7:17 pm

If you set GFL_TYPE=1 and use GetFileList>C:\*.*,DIR you get the directories in C:. You do not get a list of the subdirectories.

Similarly, a method of getting a list of all directories including subdirectories would be nice.

timle
Pro Scripter
Posts: 96
Joined: Tue Apr 20, 2004 5:53 am

Post by timle » Wed Mar 12, 2014 5:04 pm

This post kinda old but I wonder if we have any solution for this?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Get File List - Directories

Post by Marcus Tettmar » Mon Mar 17, 2014 3:44 pm

sailor dude wrote:If you set GFL_TYPE=1 and use GetFileList>C:\*.*,DIR you get the directories in C:. You do not get a list of the subdirectories.

Similarly, a method of getting a list of all directories including subdirectories would be nice.
The directories in C:\ *are* subdirectories. They are subdirectories of C:\

If you set GFL_TYPE to 1 you get a list of folders in the folder you specify.

If you want subfolders of subfolders of subfolders ..... then we need to recurse:

Code: Select all

Let>numSubDirs=0
ArrayDim>aSubDirs,numSubDirs
GoSub>getSubDirs,c:\temp

**BREAKPOINT**
ArrayCount>aSubDirs,total_dirs
MessageModal>There are %total_dirs% sub folders
//now look in the watch list at the aSubDirs array which contains entire recursive tree of sub folders 

//recursive suroutine to get subfolders ... 
SRT>getSubDirs
  Let>LOCALVARS=1
  Let>GFL_TYPE=1
  GetFileList>%getSubDirs_Var_1%\*.*,dirList
  Separate>dirList,;,dirs
  If>dirs_count>0
    Let>k=0
    Repeat>k
      Let>k=k+1
      Let>this_dir=dirs_%k%
      Let>LOCALVARS=0
      Let>numSubDirs=numSubDirs+1
      ArrayDim>aSubDirs,numSubDirs
      Let>aSubDirs_%numSubDirs%=this_dir
      Let>LOCALVARS=1
      GoSub>getSubDirs,this_dir
    Until>k=dirs_count
  Endif
END>getSubDirs
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts