0 Members and 1 Guest are viewing this topic.
if (fileName.indexOf('>') > 0) { // remove archive name tag fileName = fileName.substring(fileName.indexOf('>') + 1); }
I used to extract file name from full path by checking whether it's inside an archive with such code:Code: [Select]if (fileName.indexOf('>') > 0) { // remove archive name tag fileName = fileName.substring(fileName.indexOf('>') + 1); }After messing around I found out that it would not work properly depending on archive depth.
Currently our file name pattern is: <archive.zip>archive-inside.zip|document-inside.pdf . Wouldn't it be simpler if we had pattern like this: <archive.zip><archive-inside.zip>document-inside.pdf ?
I think limiting scan depth should even speed-up file scanning in cases where we have archived archives of various recognizable file types.
How's that?
QuoteHow's that?What about a case where we have a text-book archived with an archive of a CD content, where many file formats are recognizable by the scanner, for example, *.txt, but ultimately have no purpose for being indexed into a DB?
The archive within archive scan depth, that I just finished implementing, is about instructing the scanner how many levels of archives inside archives should be scanned.
FileName = FileName.substring(FileName.indexOf('>') + 1).split('|').slice(-1)[0];
An alternative code could be: FileName = FileName.substring(FileName.lastIndexOf('|') + 1);