Sure, this is very simple. You need my script function
GetListOfFiles and put the code of this function (without the explanation above and the demonstration code below, but read the explanation) together with following script code into a script file:
Code: Select all
// Note: Normally the directory for command Find in Files must be with backslash at end.
// But function GetListOfFiles appends it automatically and the regular expression
// below requires the root directory name without backslash to convert also the
// file names found in the root directory correct.
var sRootDir = "\\\\server\\share"
if (GetListOfFiles(0, sRootDir, "*", true)) {
UltraEdit.insertMode();
if (typeof(UltraEdit.columnModeOff) == "function") UltraEdit.columnModeOff();
else if (typeof(UltraEdit.activeDocument.columnModeOff) == "function") UltraEdit.activeDocument.columnModeOff();
UltraEdit.ueReOn();
UltraEdit.activeDocument.top();
UltraEdit.activeDocument.findReplace.mode=0;
UltraEdit.activeDocument.findReplace.matchCase=false;
UltraEdit.activeDocument.findReplace.matchWord=false;
UltraEdit.activeDocument.findReplace.regExp=true;
UltraEdit.activeDocument.findReplace.searchDown=true;
UltraEdit.activeDocument.findReplace.searchInColumn=false;
UltraEdit.activeDocument.findReplace.preserveCase=false;
UltraEdit.activeDocument.findReplace.replaceAll=true;
UltraEdit.activeDocument.findReplace.replaceInAllOpen=false;
UltraEdit.activeDocument.findReplace.replace("%"+sRootDir+"^(?++\\^)^(*^)$", "<a href=\"^1^2\">^2</a>");
UltraEdit.activeDocument.findReplace.regExp=false;
UltraEdit.activeDocument.findReplace.replace("\\", "/");
UltraEdit.activeDocument.findReplace.replace("href=\"/", "href=\"");
}
As you can see UltraEdit is used to search for the files names in all directories starting in the specified root directory. I used "
*" as file specification, but you can also use "
*.htm;*.pdf" to find only HTML and PDF files.
Next a simple
Tagged regular expression using the UltraEdit regexp engine is used to insert the tag arround the file names.
Two non regular expression replaces convert the backslashes to forward slashes and remove the forward slash at start of every URL which would not be wrong, but also not needed. And that's it.