Long Path Finder 0.1 (March 29, 2013)
Posted: 30 Mar 2013 08:22
This script allows you to find any file that has the path length longer than the length specified by you. This is generally useful if you want to know if there are any files that are longer than 256 which is the maximum path length before Windows Explorer starts to have issues with dealing with those files. Of course XYplorer can deal with long path but I made this script just to see if I can make a tool that replaces a much older tool that I have used in the past to test. Anyway, it's pretty much done and I probably won't be doing anything else to it and just decided to share it for those who wants it.
On the other hand, I also used it as a way to find a way to bypass an issue with XYplorer not being able to do much else when it's busy processing a script. The problem with finding long path is that if your system has many many files and length you specified is small (generally less than 150), the script pretty much makes XYplorer "freeze" and you can't do anything else to it until XYplorer finishes the script (which during testing with this script and my system, I had to wait for around 10 minutes) due to the amount of files it found that was longer than 150 that I had specified. Anyway, the bypassing method seems to work and the details is here:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=9473
Currently I have the results of the LongPathFinder saved in a text file called LongPath.txt which is automatically opened after the script finish. You can uncomment and comment this part of the code:
so that it will pop up a text Window with the results instead if you want while still having a hard copy in the text file.
Remember to be reasonable with the the length you specified. If it's too short like 50 and the folder you selected has thousands and thousands of file, XYplorer is pretty much going to hang and you will more than likely have to wait an extremely long amount of time. Furthermore, the more files it has to process, the more CPU and RAM it will consume. So don't complain to me if you decided to go to the root of your archive drive, select all, and run the script for s*** and giggles.

Code
The pre-run code LongPathFinder.xys:
The main program LongPathRun.xys that is run from a new instance:
On the other hand, I also used it as a way to find a way to bypass an issue with XYplorer not being able to do much else when it's busy processing a script. The problem with finding long path is that if your system has many many files and length you specified is small (generally less than 150), the script pretty much makes XYplorer "freeze" and you can't do anything else to it until XYplorer finishes the script (which during testing with this script and my system, I had to wait for around 10 minutes) due to the amount of files it found that was longer than 150 that I had specified. Anyway, the bypassing method seems to work and the details is here:
http://www.xyplorer.com/xyfc/viewtopic.php?f=7&t=9473
Currently I have the results of the LongPathFinder saved in a text file called LongPath.txt which is automatically opened after the script finish. You can uncomment and comment this part of the code:
Code: Select all
WriteFile("<xyscripts>\LongPath.txt","$LongCat",a,tu);
Open "<xyscripts>\LongPath.txt";
//Text $LongCat;Code
The pre-run code LongPathFinder.xys:
Code: Select all
/*
Long Path Finder 0.1 (March 29, 2013) by Enternal
Files: LongPathFinder.xys, LongPathRun.xys
*/
If Exists("<xyscripts>\LongPathLength.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathLength.txt"; }
If Exists("<xyscripts>\LongPathItems.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathItems.txt"; }
If Exists("<xyscripts>\LongPathRaw.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathRaw.txt"; }
If Exists("<xyscripts>\LongPath.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPath.txt"; }
$Length = Input("Long Path Finder","Files With Path Longer Than The Specified Length Will Be Listed.<crlf>Recommend Above 150. Anything Lower Could Freeze XYplorer<crlf>If There Are Many Files.","256",s,0);
$NTest = RegExMatches("$Length","\D"); // \D Same As [^0-9]. http://gskinner.com/RegExr/
If ($NTest == "") {
Continue; }
Else {
Msg "$Length Is NOT A Valid Numerical Value."; }
End ($Length == 0);
WriteFile("<xyscripts>\LongPathLength.txt","$Length",,t);
$SelectedItems = Get("SelectedItemsPathNames","|");
WriteFile("<xyscripts>\LongPathItems.txt","$SelectedItems",,tu);
Run """<xypath>\<xyexe>"" /ini=""<xyini>"" /win=min /script=""LongPathRun""";Code: Select all
/*
Long Path Finder 0.1 (March 29, 2013) by Enternal
Files: LongPathFinder.xys, LongPathRun.xys
*/
Global $Files;
$Length = ReadFile("<xyscripts>\LongPathLength.txt",t);
$LongCat = "";
$SelectedItems = ReadFile("<xyscripts>\LongPathItems.txt",t);
ForEach($Item,$SelectedItems,"|") {
If Exists($Item) == 1 {
$Files = "$Files"."|"."$Item"; }
ElseIf Exists($Item) == 2 {
$FFiles = FolderReport("files","r",$Item,"r",,"|");
$Files = "$Files"."|"."$FFiles"; } }
$Files = FormatList("$Files","e");
ForEach($Item,$Files,"|") {
If Report("{Len}",$Item) > $Length {
$LongCat = "$Item"."|";
WriteFile("<xyscripts>\LongPathRaw.txt","$LongCat",a,tu);
$LongCat = ""; } }
If Exists("<xyscripts>\LongPathRaw.txt") == 0 {
Msg "No Files With Path Longer Than $Length Found.";
Exit "n"; }
$LongCat = ReadFile("<xyscripts>\LongPathRaw.txt",t);
$LongCat = Replace(FormatList("$LongCat","enq","|"),"|","<crlf>");
WriteFile("<xyscripts>\LongPath.txt","The Following Items Have Path Longer Than $Length:<crlf><crlf>",a,tu);
WriteFile("<xyscripts>\LongPath.txt","$LongCat",a,tu);
Open "<xyscripts>\LongPath.txt";
//Text $LongCat;
If Exists("<xyscripts>\LongPathLength.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathLength.txt"; }
If Exists("<xyscripts>\LongPathItems.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathItems.txt"; }
If Exists("<xyscripts>\LongPathRaw.txt") == 1 {
Delete 0,0,"<xyscripts>\LongPathRaw.txt"; }
Exit "n";