Page 1 of 1

folderreport: How to report items with exceeding length?

Posted: 26 May 2011 13:11
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

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

Posted: 26 May 2011 13:26
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)

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

Posted: 26 May 2011 13:28
by highend
Thanks for the hint, Stefan!

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

Regards,
highend

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

Posted: 26 May 2011 13:44
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";

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

Posted: 26 May 2011 14:09
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.

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

Posted: 26 May 2011 14:34
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.

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

Posted: 26 May 2011 14:55
by admin

Code: Select all

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

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

Posted: 26 May 2011 15:33
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

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

Posted: 26 May 2011 15:48
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>");

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

Posted: 26 May 2011 15:52
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.";

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

Posted: 26 May 2011 16:44
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

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

Posted: 26 May 2011 17:35
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;

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

Posted: 26 May 2011 17:39
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 :)