Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 311 Vote(s) - 3.52 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how to retrieve directories using server-side javascript for ASP

#1
I am trying to retrieve all subfolders recursively into a character-delimited string "list" using server-side Javascript for Classic ASP. Here is my function that is supposed to do the trick:

function hasContent(text) {
if (text == undefined) {
return false;
} else if (text === undefined) {
return false;
} else if (text == "undefined") {
return false;
} else if (text === "undefined") {
return false;
} else if (typeof text == "undefined") {
return false;
} else if (text == null) {
return false;
} else if (text === null) {
return false;
} else if (text == "") {
return false;
} else if (text === "") {
return false;
} else {
return true;
}
}

function generateActualPath(path) {

try {
if (!hasContent(path)) {
return "./";
}

if (!/.+[\\/\\\\]$/.test(path)) {
path += "/";
}

if (!/^\\./.test(path)) {
path = "." + path;
}

return path;

} catch (e) {
return "./";
}
}

function retrieveDirectories(dir) {
try {
var actualPath = '/' + dir;
var obj = Server.CreateObject("Scripting.FileSystemObject");
dirs = obj.GetFolder(Server.MapPath(generateActualPath(actualPath)));
for (var enumm = new Enumerator(dirs.subFolders); !enumm.atEnd(); enumm.moveNext()) {
if (/^[a-zA-Z0-9\-_&%#]/.test(enumm.item().Name) && enumm.item().Name.trim().indexOf('_') != 0) {
if (hasContent(Session("directories"))) {
Session("directories") += enumm.item().Name + '|';
} else {
Session("directories") = enumm.item().Name + '|';
}
retrieveDirectories(enumm.item().Name);
}
}
} catch (e) {}
}

However, I only see the first-level subfolders of "dir" and nothing further, in spite of the recursive call. What might I be missing here? I verified that "dir" has up to 4 sub-levels of subdirectories that do not begin with "_" and contain legitimate alphanumeric characters per customer requirement.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through