PDA

View Full Version : SITE FIND/SEARCH <file *keyword*>


DJZacharia
05-07-2011, 11:55 PM
Hello.

I am looking for a script that can search/find for files on my site, using keywords.
I should mention, i do not want a dupe script (that will block dupe files).
I've seen a script like this for drftpd and was wondering if someone could write a script that is similar.

it should look something like this:

SITE FIND *keyword1*keyword2*keyword3*.mp3
[1] 200-.---------------------------------------------------------------------.
[1] 200-| FILES FOUND |
[1] 200-| Date | Files |
[1] 200-|------------------------------------------------------------------------|
[1] 200-| 2011-05-05 | /MP3/0505/VA-ALBUM_NAME-2010/04-artist-keyword1_(refix)_ft._keyword2.mp3 |
[1] 200-| 2011-05-05 | /MP3/0505/VA-ALBUM2_NAME-2011/02-artist-long_keyword1_keyword3.mp3 |
[1] 200-|------------------------------------------------------------------------|
[1] 200-| Displayed 2 of 2 matching found results. |
[1] 200-'------------------------------------------------------------------------'


please help me with this.
thanks :)

Yil
05-08-2011, 03:47 AM
I think I can get the functionality you want if you just play with your configuration a bit :)

First off, nxTools has the ability to track the names of all files so it can reject duplicates, but it doesn't bother to do so unless you have enabled dupe checking of files. So go do this now in your nxTools.cfg file:

set dupe(CheckFiles) True

Also make sure you have enabled filename scanning during database rebuilds for all paths via:

set dupe(RebuildPaths) {
{{/} {d:/site} True True}
}
The second true means you want to update the file database. Now go double check all the paths match those in the .vfs file.

Now for the tricky part! If you have the following settings:
set force(NfoFirst) False
set force(SfvFirst) False
set force(SampleFirst) False

Then all you need to do is comment out the following line in ioFTPD.ini and you are done:
[FTP_Pre-Command_Events]
; stor = TCL ..\scripts\nxTools\nxDupe.tcl PRESTOR


However, if you have any of the force file options set then you can't comment out the line without loosing those features, so you'll need to edit nxTools/nxDupe.tcl and change this:
PRESTOR {
set virtualPath [PathNormalizeEx $user $group $pwd [join [lrange $argList 2 end]]]
if {[IsTrue $force(NfoFirst)] || [IsTrue $force(SfvFirst)] || [IsTrue $force(SampleFirst)]} {
set result [ForceCheck $virtualPath]
}
if {!$result && [IsTrue $dupe(CheckFiles)]} {
set result [CheckFiles $virtualPath]
}
}


to this:

PRESTOR {
set virtualPath [PathNormalizeEx $user $group $pwd [join [lrange $argList 2 end]]]
if {[IsTrue $force(NfoFirst)] || [IsTrue $force(SfvFirst)] || [IsTrue $force(SampleFirst)]} {
set result [ForceCheck $virtualPath]
}
}



After making these changes, you'll need to import all the filenames be rescanning the directories via "SITE REBUILD".

When that is done, you can use 'SITE FDUPE [-max <limit>] <filename>' just like you can use 'SITE DUPE [-max <limit>] <release>'. I know the documentation says it matches specific releases or files, and you need to use 'SITE SEARCH' instead, but I happen to know it's the same function so it will wildcard search.

You can modify how FDUPE outputs the results by editing the scripts/nxTools/text/FileDupe* files...

I'd also like to suggest you backup your configuration before trying this just in case it doesn't work. Assuming your footer is accurate and you are using v6.9.3 I would suggest you bite the bullet and do the HUGE upgrade to v7.7.1. I know it's a lot of work to redo/merge the ioFTPD.ini file, but it's probably worth it for you. Once you have done that you can check out the source\nxSearch.itcl script by copy it to the scripts dir, and searching for the name in ioFTPD.ini and enabling it. I find using the /Search dir very helpful since it provides links right to the item so you can just click on the dir you want. This script is similar to the older ioNxSearch in v6.x but v7 provides you the ability to have multiple scripts and a bunch of new features. If you find you like the feature let me know and I can tweak the script to search for files instead of dirs so you could have a /SearchFiles auto-linking search script. I'm not sure, but I think you could then just download the files right from the returned virtual listing.

DJZacharia
05-08-2011, 02:06 PM
Thanks, Yil. That worked great :)

I am planning to upgrade to v7.7.1, sometime within the next month or so (need to dedicate a few days to doing it, when i am off frmo work).

Thanks again for you help :)

FTPServerTools
05-10-2011, 02:49 PM
Or use my site search http://tinyurl.com/freeftpservertools/files which works on command line..

ioFTPD setup:
edit ioFTPD.ini and add under [FTP_CustomCommands]
SEARCH = %EXEC ..\scripts\sitesearch.exe TIMEOUT=5000 START="%[$path]"

ioFTPD and ftp client side effects:
if the query takes too long your client will return without a result. To avoid that use the TIMEOUT=.
etc.. just read the text file..