- Search junctions (or symlinks) in file system by target path.
- Replace target path on found junctions (or just delete broken junction and create new one with updated target in the same place).
Managing junctions / symlinks
Managing junctions / symlinks
Hi. I plan to have sort of system consisting of many junctions. Junction is bound to target path, which could be sometime changed. So, the question – is there any way in XY to:
Re: Managing junctions / symlinks
Only by scripting
One of my scripts helped you out? Please donate via Paypal
Re: Managing junctions / symlinks
Code: Select all
property()
One of my scripts helped you out? Please donate via Paypal
Re: Managing junctions / symlinks
E.g.:
Code: Select all
// The destination path that a junction must point to (or a subfolder of it)
$dstForJunction = "D:\";
// Get all folders recursively from the current folder and from them only the junctions...
$folders = quicksearch("/d", , , "sm");
$junctions = regexmatches($folders, "^.+\|...D...J", <crlf>);
$junctions = regexreplace($junctions, "^(.+?)\|(.*?(?=\r?\n|$))", "$1");
if !($junctions) { status "No junctions found, aborted!", "8B4513", "stop"; end true; }
$log = "";
foreach($junction, $junctions, <crlf>, "e") {
$target = property("#JunctionTarget", $junction);
if (strpos($target, $dstForJunction) != -1) {
$log .= $junction . " -> " . $target . <crlf>;
// Do your own stuff, write .bat file entries / or repair / delete
// with XY scripting (but only if XY is running elevated!)
}
}
if ($log) { text $log; }
One of my scripts helped you out? Please donate via Paypal