Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
souadouert
Specialist
Specialist

folder names

Hello

Can i Uses repetitive loop as for, while ... with folder names

For example, I want to save the folder names of a path in array and then I loop on that variable

i uses this script

FOR Each vSubFolder in DirList(vBaseDirName)

   SET vSFolder = $(vSubFolder)\*;

FOR Each vInnerFolder in DirList(vSFolder)

folder:

LOAD * INLINE [

foldername

$(vInnerFolder)

];

NEXT vInnerFolder

NEXT vSubFolder

1 Solution

Accepted Solutions
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

If I understand your requirement clearly, I feel you dont need to use the variable to do this. All you need is below script.

sub DoDir (Root)

   for each Ext in 'qvw', 'qva', 'qvo', 'qvs', 'qvc', 'qvd'

      for each File in filelist (Root&'\*.' &Ext)

         LOAD

            '$(File)' as Name,

            FileSize( '$(File)' ) as Size,

            FileTime( '$(File)' ) as FileTime

         autogenerate 1;

      next File

   next Ext

   for each Dir in dirlist (Root&'\*' )

      call DoDir (Dir)

   next Dir

end sub

call DoDir ('C:')

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!

View solution in original post

3 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Hi,

If I understand your requirement clearly, I feel you dont need to use the variable to do this. All you need is below script.

sub DoDir (Root)

   for each Ext in 'qvw', 'qva', 'qvo', 'qvs', 'qvc', 'qvd'

      for each File in filelist (Root&'\*.' &Ext)

         LOAD

            '$(File)' as Name,

            FileSize( '$(File)' ) as Size,

            FileTime( '$(File)' ) as FileTime

         autogenerate 1;

      next File

   next Ext

   for each Dir in dirlist (Root&'\*' )

      call DoDir (Dir)

   next Dir

end sub

call DoDir ('C:')

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
souadouert
Specialist
Specialist
Author

thank you kaushik So helpful script

kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

Pleasure.

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!