Page 2 of 2 <12
Topic Options
#77008 - 2003-10-08 05:33 PM Re: Detect New File Presence
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh, I counted 4 scripts [Confused]

and no, can't combine those as they are totally different stuff.
you can rip them together from my scripts but...
as noticed with testing along with DOC that the 1st 2nd and 3rd work fine for one purpose, to get the newist file.
but to see see the file last copied to folder, one needs to use the last code.
_________________________
!

download KiXnet

Top
#77009 - 2003-10-08 06:21 PM Re: Detect New File Presence
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11628
Loc: CA
A couple of observations

1. Code works good for 1 file and path used in code.

2. Code does not support locating/displaying multiple added files (but was not requested by original requester)

3. Change of path seems to disable script from finding newly copied or created files.
ie.

Adding files to a subfolder named RELEASE under the location of where the script was launched works with this.

$dir=@scriptdir+"\release\"

Changing the code to use this path prevents code from finding changes. It finds the NEWEST file, but no addition of files.

$dir="C:\WINDOWS\SYSTEM32\"

Using KIX32.EXE v4.21 on Windows XP w/SP1

[ 08. October 2003, 18:23: Message edited by: NTDOC ]

Top
#77010 - 2003-10-08 06:48 PM Re: Detect New File Presence
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
What aboout file changes too? For example, if I run SYSEDIT and changed the WIN.INI..

I know that is out-of-scope for this topic, but something to ponder.

Kent

[ 08. October 2003, 18:48: Message edited by: kdyer ]
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#77011 - 2003-10-08 07:04 PM Re: Detect New File Presence
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
Kent,

Not to hijack the thread further, but I can have something for you later for modified files.

Top
#77012 - 2003-10-08 10:09 PM Re: Detect New File Presence
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
I can add Win32-ChangeNotify functionality to a either my existing or a new DLL. I could notify on one or a combination of:
code:
   ATTRIBUTES   Any attribute change
DIR_NAME Any directory name change
FILE_NAME Any file name change (creating/deleting/renaming)
LAST_WRITE Any change to a file's last write time
SECURITY Any security descriptor change
SIZE Any change in a file's size

Here is an example script of my prototype DLL:
code:
$= SetOption("WrapAtEol","On")
? "KiXtart version = " @KIX

$HABObject1 = createobject("HBullock.AdminObjects")
if vartypename($HABObject1) <> "Object"
? "@serror"
endif


$ChangeNotify = $HABObject1.NewChangeNotify ("c:\data\scripts", 1, "FILE_NAME")
? "@error @serror"
?
$ChangeNotify.print
? "@error @serror"

$result = $ChangeNotify.wait
Cerror()
? "@error @serror"

? "result = " + $result
if $result
? "Something changed"
else
? "Failure " + @error
endif


Function Cerror()
exit Iif(@error<0,VAL("&"+Right(DecToHex(@error),4)),@error)
Endfunction

I should be able to create mutliple instances of various $ChangeNotify objects, but a problem in t my Perl code is presently preventing that from occurring.

Another example:
break ON


$= SetOption("WrapAtEol","On")
? "KiXtart version = " @KIX

$HABObject1 = createobject("HBullock.AdminObjects")
if vartypename($HABObject1) <> "Object"
? "@serror"
endif


$ChangeNotify1 = $HABObject1.NewChangeNotify ("c:\data\scripts", 1, "FILE_NAME")
? @error
$ChangeNotify2 = $HABObject1.NewChangeNotify ("c:\data\scripts", 1, "SIZE")
? @error

while (1)
do
$i = 1+ $i
$result1 = $ChangeNotify1.wait(100) ; milliseconds
$result2 = $ChangeNotify2.wait(100) ; milliseconds
? "Timeout: " + $i
until $result1 <> 0 or $result2 <> 0

if $result1
? "FILE_NAME: Something changed"
$ChangeNotify1.reset
;Do Something about it...
endif
if $result2
? "SIZE: Something changed"
$ChangeNotify2.reset
;Do Something about it...
endif
loop


[ 08. October 2003, 22:12: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#77013 - 2003-10-09 08:52 AM Re: Detect New File Presence
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if it does work for other dirs and for others not, could wonder why.
it's not about script then anymore.

hoby, nice idea.
what about telnet too?
_________________________
!

download KiXnet

Top
Page 2 of 2 <12


Moderator:  Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 657 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

Generated in 0.101 seconds in which 0.071 seconds were spent on a total of 11 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org