volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

volume_up

A critical vulnerability was discovered in React Server Components (Next.js). Our systems remain protected but we advise to update packages to newest version. Learn More

Get all (unified) files

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

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

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
error 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.