November Happy Hour will be moved to Thursday December 5th.

Get all (unified) files

Vote:
 

Is it possible to retrive all files in an directory and it's subdirectories? Let's say we have the following structue:

root
    folder A
        File A-A
        File A-B
        folder B
            File B-A

Can i retrive all these files (File A-A, File A-B, File B-A ect) if I only have the root-path?



 

#36705
Feb 08, 2010 16:34
Vote:
 

If I'm not mistaken there is a filesystemdatasource control that you can use. I think you can specify the depth you're intrested in.

Check the sdk.

#36772
Feb 10, 2010 14:19
Vote:
 

Or make your own function

void GetAllFiles(UnifiedDirectory start, List<UnifiedFile> files)
{

    foreach (UnifiedFile file in start.GetFiles())
    {
        files.Add(file);
    }
    foreach (UnifiedDirectory dir in start.GetDirectories())
    {
        GetAllFiles(dir, files);
    }
}

#36785
Feb 10, 2010 15:50
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.