PDA

View Full Version : esmNewdir


esmandil
12-14-2004, 09:38 AM
http://www.ioftpd.com/scripts/script.php?id=166
Excerpts for ReadMe.txt:

##################################################
This is a newdir/dupe script for ioFTPD, created by Esmandil
version 0.35 (11.12.2004)

It uses sqlite database, so it is pretty fast: I have tested with
database of over 1.000.000 directories and it still took less than 0.5
seconds to MKD. On the other hand, the dupe db takes a bit more (about
50% more, probably) space than flat text file would. It is well worth
it, though :D

This script was heavily influenced by NEWDIR V3.5.2 by B0unTy
-- big thanks, B0unty! :)

##################################################

Usage:

site new [<section>] [<count>] [<pattern>]
site dupe <pattern> [<section>] [<count>]
site undupe <dirname>

Deleting a directory removes it from the dupe database.
Wipe-ing a directory keeps it in dupe database.

##################################################

Example of use:


MKD test1
257 "test1" created.

MKD test1
550 This dir looks like a dupe!

site undupe test1
200-Successfully unduped test1

site new D*V 3 tes
200-## Age Owner Section Name
200--- -------- ---------- ---------- -------------
200-01 01d 04h ioFTPD DVDR test1
200-02 03d 00h ioFTPD DiVX test2
200-03 03d 00h ioFTPD DiVX test3
200-Usage: site new [<section>] [<count>] [<pattern>]

site dupe test gam 3
200-## Age Owner Section Name
200--- -------- ---------- ---------- -------------------
200-01 00m 02s ioFTPD game test7
200-02 02m 15s ioFTPD game test8
200- Notes: Wiped by ioFTPD on 2004-12-10 20:30:07,
200-03 01d 04h ioFTPD games_old test9
200- Notes: Unduped by ioFTPD on 2004-12-10 20:38:04
200-Usage: site dupe <pattern> [<section>] [<count>]


##################################################

!!! ATTENTION: batch script(s) I use -- namely run.bat -- have only
!!! been tested on WinXP. I am pretty sure they will work on 2000 as
!!! well, but most probably won't in 9x. If somebody manages to write
!!! it in a portable way, I would love to get my hands on it ;)

##################################################

Have fun :D

CoLt-[45]
03-02-2005, 07:07 AM
Sound nice script, is there's a way I can use FILE instead of DIR ?

Dupe Filename is important to me :/

Thanks

esmandil
03-03-2005, 09:01 AM
I never tried :D

But simply changing

[Events]
OnNewDir = %EXEC ..\scripts\esmNewdir\run.bat OnNewDir %[$user]

into

[FTP_Pre-Command_Events]
stor = %EXEC ..\scripts\esmNewdir\run.bat OnNewDir %[$user]

might work... or maybe not, depending if ioftpd gives the same parameters to "OnNewDir" and to "stor".

mr_F_2
03-03-2005, 11:19 AM
Originally posted by esmandil
I never tried :D

But simply changing

[Events]
OnNewDir = %EXEC ..\scripts\esmNewdir\run.bat OnNewDir %[$user]

into

[FTP_Pre-Command_Events]
stor = %EXEC ..\scripts\esmNewdir\run.bat OnNewDir %[$user]

might work... or maybe not, depending if ioftpd gives the same parameters to "OnNewDir" and to "stor".

well why don't you test it next time?
this is the output:

150 Opening BINARY mode data connection for 00-a_perfect_circle-thirteenth_step-covers-2003-ube.jpg.
argc=3
Param 0 = ..\scripts\checkscript.exe
Param 1 = STOR
Param 2 = 00-a_perfect_circle-thirteenth_step-covers-2003-ube.jpg


not sure if it matches your script

//mr_F

esmandil
03-04-2005, 06:43 PM
well why don't you test it next time?


Why should I? ;-) As the name says, it is newDIR script, not newFILE script... using it as dupe filename is not supported.

As I said, it shouldn't be difficult to make it work. But I do not intend to do it.


this is the output:


Thanks.


not sure if it matches your script


well why don't you test it next time? ;) ;) ;)

# usage: sh.exe OnNewDir.sh <createdBy> <realPath> <fullDirPath>

So no, it does not match my script expectations. But it can be made compatible with some clever usage of cookies.

mr_F_2
03-04-2005, 06:49 PM
Originally posted by esmandil

well why don't you test it next time? ;) ;) ;)


lol. ;)
i did my part :P

esmandil
05-05-2005, 03:45 PM
OK, new version uploaded.

Rewritten as TCL script, so it should be easier to install -- and maybe slightly faster as well.

Not many things changed:
+ added file dupe check (I don't use it myself, so it's mostly untested)
+ added option to purge database

CoLt-[45]
05-05-2005, 03:57 PM
Heh, nice one.. will test that later tonight ;)

Will mention here if I find any bug(s) ;) (wish I hope not :p)

esmandil
05-05-2005, 04:10 PM
Sure. I have tested it a bit, so it should at least appear to work.

But I honestly never could understand what people use file dupe for... ;)

Anyway, I will hopefully be able to fix any bugs you find :D

CoLt-[45]
05-07-2005, 10:36 AM
[R] site undupe
[R] 200-Usage: "site undupe <user> <dirname>"

Can undupe a dirname.. but what's the command to undupe a filename? :p

Maybe a small fix? or am I missing something here? :p

Would like to have something like "site undupe <filename>" as I don't see the point to have "site undupe <user> <filename>"

BTW, script is pretty straight forward, easy to install - glad with it so far but haven't reaches to 50,000th files yet :) (will do it right after i've got this small fix)


!!! ATTENTION: batch script(s) I use -- namely run.bat -- have only
!!! been tested on WinXP. I am pretty sure they will work on 2000 as
!!! well, but most probably won't in 9x. If somebody manages to write
!!! it in a portable way, I would love to get my hands on it

You've mentioned a batch file, maybe you could tell me where to find it? - or have it send to me so that I can add all those 50,000+ files to the db without having to upload it all over again :p



Hope you can help :)

TIA

esmandil
05-07-2005, 03:01 PM
Can undupe a dirname.. but what's the command to undupe a filename?

"site fileundupe <filename>" should work...

as I don't see the point to have "site undupe <user> <filename>"

The "user" part is filled automatically by ioFTPD... even if isn't really all that useful ;) Sorry it isn't clear from the documentation.

You've mentioned a batch file, maybe you could tell me where to find it?

Are you sure you have an up-to-date version of my script? The bat file is no more -- it was only used before I had TCL script.

And no, I have no way of adding files to the db. I may code something like this, but no promises.

jeza
05-08-2005, 07:59 AM
################################################## ####################

There are a couple of things I am thinking about adding... Would you
find any of them useful?

* nuked/unnuked to db (how should it work?)
* pre (what support does pre need?)

site dupe test gam 3
200-## Age Owner Section Name
200--- -------- ---------- ---------- -------------------
200-01 00m 02s ioFTPD game test7
200-02 02m 15s ioFTPD game test8
200- Notes: Wiped by ioFTPD on 2004-12-10 20:30:07,
200-03 01d 04h ioFTPD games_old test9
200- Notes: Unduped by ioFTPD on 2004-12-10 20:38:04
200-04 01d 04h ioFTPD games_old test9
200- Notes: Nuked 3x by ioFTPD on 2004-12-10 20:38:04 because reason
200-04 01d 04h ioFTPD games_old test9
200- Notes: UnNuked by ioFTPD on 2004-12-10 20:38:04 because reason
200-Usage: site dupe <pattern> [<section>] [<count>]

pre :
select type of pre :
site pre rls type
site pre type rls

nuke = %TCL ..\scripts\esmNewdir\esmNewdir.itcl SiteNuke
unnuke = %TCL ..\scripts\esmNewdir\esmNewdir.itcl SiteunNuke
pre = %TCL ..\scripts\esmNewdir\esmNewdir.itcl SitePre

esmandil
06-05-2005, 05:26 PM
New version (0.60) released.

Changelog:

0.60 -- minor upgrade
+ newer version of tclsqlite3.dll included, be sure to replace!
+ storing nuke/unnuke messages in database
+ pre support added
+ dupe can now report results by private message

esmandil
06-09-2005, 08:52 AM
0.65 -- minor upgrade
+ "site fileundupe" now reports number of unduped files
+ rewritten ReadMe.txt so those too lazy to read it whole will now only install directory dupe, not file dupe ;)
+ Customisable column widths
+ !new can now report results by private message too
+ An option to exclude some files from dupe database
+ "site esmNewdir Import" command added to import existing dirnames (be careful, it is pretty limited)
+ Fixed problem with "[]" characters in dirnames

mentality
06-10-2005, 06:49 PM
try setting 'ioerror' 0


tahts, return '0'

esmandil
06-12-2005, 05:39 PM
try setting 'ioerror' 0

What do you mean? I actually *do* set ioerror to 0 (if there are no errors during execution of my script.

esmandil
11-02-2005, 09:05 AM
New version is available:

0.70 -- minor upgrade
+ Nuked directories are now handled correctly
+ Increased timeout for "database is locked" error
+ Added support for section aliases
+ Added support for "wipe -r" for people who use both ioftpd and glftpd

ChipMunk666
11-21-2005, 04:24 PM
Ok i looked into your script and i find it rather fascinating but i have a question.
I see db_schema.sql to put in a sql database.
But i don't see anything where i put this and how esmnewdir connects to it doesn't it need the required database in the sql server etc?And where to connect etc?
I want to use this with iosharedb.So a global dupe system.
But can't find any information about connecting it to the sql database.

JoeBAR
11-21-2005, 10:24 PM
It uses sqllite, no connection, just a dll which store data in 'sql' fashion

ChipMunk666
11-22-2005, 06:55 AM
ow ok thx why the sql table than?

esmandil
11-23-2005, 06:00 AM
EsmNewdir uses SQL database to manage the data, but it is a lightweight one called sqlite. It does not connect to any SQL server, it stores all its data in a single file.

The esmnewdir.db file already has the correct schema loaded, the file is just for reference if somebody is interested :)

That said, it wouldn't be difficult to use some SQL server to keep the database in -- provided you have a way of accessing such server from tcl. I will not be doing anything like this, at least not in near future, but if you know some tcl you should be able to modify esmNewdir without much problem.