Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7626927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:23:29+00:00 2026-05-31T05:23:29+00:00

So here is my scenario — I am collecting a dynamic folder structure with

  • 0

So here is my scenario — I am collecting a dynamic folder structure with javascript for a photoshop plugin I am developing. Here is what the folders may look like:

Folder 1
    subFolder1
        file1
        file2
    subFolder2
        subsubfolder1
        subsubfolder2
           file1
           file2


 Folder 2
        subFolder1
            file1
            file2
        subFolder2
            subsubfolder1
            subsubfolder2
               file1
               file2

What would this syntax look like? tried to come up with it, but doesn’t look right to me. Also how would you loop through something like that? Do you for look on every sub array?

var multiArray = [ [Folder1, [subFolder1, [file1,file2],subFolder2, [subsubFolder1, subsubFolder2, [file1,file2] ], Folder2, [subFolder1, [file1,file2], subFolder2, [subsubfolder1,subsubfoler2, [file1,file2]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T05:23:30+00:00Added an answer on May 31, 2026 at 5:23 am
    var who = {
       just: "an object",
       with: "a couple of properties"
    };
    
    var ArrayOofArrays = [
        [1,2,3],
        [4,5,7],
        [1,{},""],
        ["a",2,{c: "b",e: who}]
    ];
    

    In your example:

    var folder = {
        subfolders: [
            subfolder,
            subfolder
        ],
        files: [
            file,
            file
        ]
    };
    

    subfolder would be ->

    var subfolder = function () {
        return {
            folders: [
            ],
            files: [
            ],
            path: "path/to/folder" // etc..
        }
    };
    

    file would be ->

    var fileInfo = function () {
        return {
            filename: "path/to/file" // etc.
        };
    }
    

    it really depends on what you want to achieve, but generally a combination of objects and arrays is best.

    so you could have something like

    var buildFolder = function(){
        return {
            folders: [],
            files: []
        };
    };
    
    var buildFile = function(title){
        return {
            title: title
        };
    };
    
    var folder = buildFolder();
    
    folder.files.push(buildFile());
    folder.files.push(buildFile());
    folder.files.push(buildFile());
    folder.files.push(buildFile());
    
    folder.folders.push(buildFolder());
    folder.folders[0].files.push(buildFile());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my scenario: I'm opening a window from a javascript file, and setting an
Here's a scenario I'm exploring for a plugin framework: A third party plugin developer
Here's the scenario I would like to know if a date like '2011-03-04' and
Here is the scenario: I am developing a web application written in servlet JSP.
Tackling a strange scenario here. We use a proprietary workstation management application which uses
Here's my scenario - I have an SSIS job that depends on another prior
Here is the scenario: I'm writing an app that will watch for any changes
Here's the scenario: A C# Windows Application project stored in SVN is used to
Here is the scenario that I have. I have a cvs repository in one
Here's the scenario-- you've got a JSON object on the browser, and let's say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.