folderreport: How to report items with exceeding length?

Discuss and share scripts and script files...
Post Reply
highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

folderreport: How to report items with exceeding length?

Post by highend »

Hi,

is there a way to let folderreport only output files / directories that exceed the normal 260 character limitation?

Background: I'm syncing my folders with HiDrive (Strato) via rsync and I want to be sure that nothing is lost (because rsync skips all things beyond the character limit).

Tia,
highend
One of my scripts helped you out? Please donate via Paypal

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: folderreport: How to report items with exceeding length?

Post by Stefan »

highend wrote:Hi,

is there a way to let folderreport only output files / directories that exceed the normal 260 character limitation?

Background: I'm syncing my folders with HiDrive (Strato) via rsync and I want to be sure that nothing is lost (because rsync skips all things beyond the character limit).

Tia,
highend
Once you have the report from folderreport() you could do
For Each Line in Lines Do
if (strlen(Line)>259)

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: folderreport: How to report items with exceeding length?

Post by highend »

Thanks for the hint, Stefan!

I hope I'll get this into a small script by myself ;)

Regards,
highend
One of my scripts helped you out? Please donate via Paypal

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: folderreport: How to report items with exceeding length?

Post by serendipity »

highend wrote:Hi,

is there a way to let folderreport only output files / directories that exceed the normal 260 character limitation?

Background: I'm syncing my folders with HiDrive (Strato) via rsync and I want to be sure that nothing is lost (because rsync skips all things beyond the character limit).

Tia,
highend
Not sure if this is useful, but you can search for items with certain length using script:
goto "?lent: < 259";

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: folderreport: How to report items with exceeding length?

Post by admin »

serendipity wrote:
highend wrote:Hi,

is there a way to let folderreport only output files / directories that exceed the normal 260 character limitation?

Background: I'm syncing my folders with HiDrive (Strato) via rsync and I want to be sure that nothing is lost (because rsync skips all things beyond the character limit).

Tia,
highend
Not sure if this is useful, but you can search for items with certain length using script:
goto "?lent: < 259";
Note that lent is just for the file title. Use len for whole path/file.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: folderreport: How to report items with exceeding length?

Post by highend »

@serendipity

No, sorry. I need a text output in a window, not a normal search result inside XYplorer.

Quick question: How do I append new lines to a variable (inside a foreach loop)?

Code: Select all

	$filelist = folderreport("items", "r", , "r");
	
	foreach($line, $filelist, "<crlf>"){
		if (strlen($line)>259){
			$result = $line;
		}
	}
The result variable will only be replaced in this case. I'd like to use a "text $result;" at the end of the script to output all lines which exceed the char limit in a XYplorer window.
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 66249
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: folderreport: How to report items with exceeding length?

Post by admin »

Code: Select all

$result = $result . $line . <crlf>;

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: folderreport: How to report items with exceeding length?

Post by highend »

Thanks admin.

Script is ready so far:

Code: Select all

//Report folder and filename lengths which are larger than 259 characters
	//setting('BackgroundFileOps', 0);
	$result = "";
	$filelist = folderreport("items", "r", , "r");
	
	foreach($line, $filelist, "<crlf>") {
		if (strlen($line)>259) {
			$result = $result . $line . <crlf>;
		}
	}

	if ($result!="") {
		text $result;
	}
	else {
		msg "Keine überlangen Pfade / Dateien gefunden.";
	}
If I use it for a folder (with subfolders and files) with 7333 files, 523 dirs (1,06gb data) XYplorer begins to freeze ("Keine Rückmeldung" in the window title) for quite a while. It will recover from this state.

During that time I get a blue arrow in the status bar with "report done in 442,5 ms" and after XYplorer is usable again it switches to a green checkmark and the same statement on the right side.

Too much data to process or are there any speed improvements / workarounds possible?

Regards,
highend
One of my scripts helped you out? Please donate via Paypal

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: folderreport: How to report items with exceeding length?

Post by serendipity »

highend wrote:@serendipity

No, sorry. I need a text output in a window, not a normal search result inside XYplorer.
Yes you can get it in the text output window too. Does something like this work for you?

Code: Select all

//Report file paths greater than 259 chars
  goto "?len: > 259 /r";
  text report ("{Path}\{Name}<crlf>");
Last edited by serendipity on 26 May 2011 16:01, edited 2 times in total.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: folderreport: How to report items with exceeding length?

Post by Stefan »

Good work :lol:
highend wrote: XYplorer begins to freeze ("Keine Rückmeldung" in the window title)

Too much data to process or are there any speed improvements / workarounds possible?


Maybe try:

Code: Select all

//Report folder and filename lengths which are larger than 259 characters
   //setting('BackgroundFileOps', 0);
   $result = "";

   $iter=0; $files=0;

   $filelist = folderreport("items", "r", , "r");
   
   foreach($line, $filelist, "<crlf>") {

   incr $iter; incr $files;
   If ($iter > 99){wait 500; status "processing files: $files"; $iter=0;}

      if (strlen($line)>259) {
         $result = $result . $line . <crlf>;
      }
   }

   if ($result!="") {
      text $result;
   }
   else {
      msg "Keine überlangen Pfade / Dateien gefunden.";
   }

Perhaps you like to implement this POC (prove of concept) code?


to show status like "In process \ - / |

Code: Select all

 $Loop=0;
 $amount=30;
 while($Loop < $amount)
 {

 //--------------------------------
 $SBT="/"; if($SBL >4){$SBL=1;}
 if($SBL==1){$SBT="/"}; if($SBL==2){$SBT="-"};
 if($SBL==3){$SBT="\"}; if($SBL==4){$SBT="|"};
 status "In process $SBT"; wait 100; incr $SBL;
 //--------------------------------


 incr $Loop;
 }
 status "Done.";



or to show "In process ..."

Code: Select all

 $s="";
 $Loop=0;
 $amount=30;
 while($Loop < $amount)
 {
 
	 if (strlen($s)>3){$s="";}
	 $s = $s.".";
	 status "In process$s";
	 wait 1000;
	 incr $Loop;
 }
 status "Done.";

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: folderreport: How to report items with exceeding length?

Post by highend »

@serendipity

Ähm... wow!

@Stefan

Danke für die ganze Mühe, aber ich glaub serendipity hat hier gerade das Rennen gemacht :)

Stefan's script takes off the load from XYplorer and makes it at least usable while the script is active.
But...

I used both scripts on my D: partition. 332GB, over 100.000 files, >11.000 dirs.

serendipity: it takes less than 2 seconds to finish it
mine / Stefan's: I killed the XYplorer task after a minute *g*

Is there a way to close the locked search tab (automatically and in the background), after the text command has been executed?

Regards,
highend
One of my scripts helped you out? Please donate via Paypal

serendipity
Posts: 3360
Joined: 07 May 2007 18:14
Location: NJ/NY

Re: folderreport: How to report items with exceeding length?

Post by serendipity »

highend wrote:@serendipity

Ähm... wow!

@Stefan

Danke für die ganze Mühe, aber ich glaub serendipity hat hier gerade das Rennen gemacht :)

Stefan's script takes off the load from XYplorer and makes it at least usable while the script is active.
But...

I used both scripts on my D: partition. 332GB, over 100.000 files, >11.000 dirs.

serendipity: it takes less than 2 seconds to finish it
mine / Stefan's: I killed the XYplorer task after a minute *g*

Is there a way to close the locked search tab (automatically and in the background), after the text command has been executed?

Regards,
highend
Glad this works for you. I suggested the search method because for many files its way faster.
Yes, you can close the search tab like this:

Code: Select all

//Report file paths greater than 259 chars
  goto "?len: > 259 /r";
  text report ("{Path}\{Name}<crlf>");
  tab ("lock", ,0);
  #351;

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: folderreport: How to report items with exceeding length?

Post by highend »

serendipity wrote:

Code: Select all

//Report file paths greater than 259 chars
  goto "?len: > 259 /r";
  text report ("{Path}\{Name}<crlf>");
  tab ("lock", ,0);
  #351;
Thanks again, works fine :)
One of my scripts helped you out? Please donate via Paypal

Post Reply