Page 2 of 2 <12
Topic Options
#24839 - 2002-07-11 09:17 PM Re: How to find a file????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so something like this:
code:
$id = file name found previously
$sourcefile="c:\Lotus\Notes\Data\names.nsf"
$targetdir="\\orrm\domino\local_notes\"+$id+".id"
if not exist($targetdir)
md $targetdir
copy $sourcefile $targetdir

??
_________________________
!

download KiXnet

Top
#24840 - 2002-07-11 09:20 PM Re: How to find a file????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
btw, the syntax:
code:
$id = dir("c:\lotus\notes\data\*.id")
if @error = 0
? "no error"
else
@error = 1
? "there is an error"+ @serror+"You should notify the Administrator"
endif

should be
code:
$id = dir("c:\lotus\notes\data\*.id")
if @error = 0
? "no error"
else
? "there is an error"+ @serror+"You should notify the Administrator"
endif

and simpler (also faster)
code:
$id = dir("c:\lotus\notes\data\*.id")
if @error
? "there is an error"+ @serror+"You should notify the Administrator"
endif

_________________________
!

download KiXnet

Top
#24841 - 2002-07-11 09:37 PM Re: How to find a file????
atiisler Offline
Fresh Scripter

Registered: 2002-07-10
Posts: 34
Thanks for all the syntax help...

whats happening using the current code is that the folder atiisler.id is being created on the network drive
but once it gets to

code:
copy $sourcefile $targetdir

It is telling me (with use of error routine)
"The system can not find the path specified
c:\Lotus\Notes\data\names.nsf to directory \\orrm\domino\loca_notes\atiisler.id"

Both the names.nsf exists and the atiiser.id folder was created.??????
Do I need to change back to some directory is my copy statement correct????

Top
#24842 - 2002-07-11 09:46 PM Re: How to find a file????
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Use '\\orrm\domino\loca_notes\atiisler.id\' (with a backslash at the end.
_________________________
There are two types of vessels, submarines and targets.

Top
#24843 - 2002-07-11 09:55 PM Re: How to find a file????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
so, going again with the whole peace...
code:
$id = dir("c:\lotus\notes\data\*.id")
if @error
? "there is an error"+ @serror+"You should notify the Administrator"
else
$sourcefile="c:\Lotus\Notes\Data\names.nsf"
$targetdir="\\orrm\domino\local_notes\"+$id+".id"
if not exist($targetdir)
md $targetdir
endif
if not exist($targetdir+"\names.nsf")
copy $sourcefile $targetdir+"\names.nsf"
endif

this copies if not file exist.
it also creates the dir if it does not exist.

cheers,
_________________________
!

download KiXnet

Top
#24844 - 2002-07-11 10:00 PM Re: How to find a file????
atiisler Offline
Fresh Scripter

Registered: 2002-07-10
Posts: 34
Where should I use that? I can not hard code the atiiser.id because it will be diffrent for each user.
Whats weird is that if I create any other folder it will do the copy...just not when I use the $id even though the folder is created.

Top
#24845 - 2002-07-11 10:09 PM Re: How to find a file????
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Jooel,
In your sample code, you are missing the EndIf.

Also your concatenation doubles the .id at the end. Perhaps should be:

$targetdir="\\orrm\domino\local_notes\"+$id+"\"
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#24846 - 2002-07-11 10:13 PM Re: How to find a file????
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Corrected code:
code:
$id = dir("c:\lotus\notes\data\*.id")
if @error
? "there is an error"+ @serror+"You should notify the Administrator"
else
$sourcefile="c:\Lotus\Notes\Data\names.nsf"
$targetdir="\\orrm\domino\local_notes\"+$id+".id"
if not exist($targetdir)
md $targetdir
endif
copy $sourcefile $targetdir+"\"
endif

_________________________
There are two types of vessels, submarines and targets.

Top
#24847 - 2002-07-11 10:18 PM Re: How to find a file????
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
les, you are right.

and also jens correction is corrected in correct.
but does he want to copy everytime or just when the file does not exist...

sorry boys, trying to watch movie at the same time when writing these...

cheers,
_________________________
!

download KiXnet

Top
#24848 - 2002-07-11 10:24 PM Re: How to find a file????
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
He mentions that he wants a backup of the file in question. Therefore, I believe, overwriting it with a newer version should be okay.
_________________________
There are two types of vessels, submarines and targets.

Top
#24849 - 2002-07-11 10:36 PM Re: How to find a file????
atiisler Offline
Fresh Scripter

Registered: 2002-07-10
Posts: 34
THaT did it!!!!!!
This line of code did it..Its all in the syntax.

code:
$targetdir="\\orrm\domino\local_notes\"+$id+"\"

I want to thank all of you for your help thus far.

Tomorrow I will finish this little script....
THANKS AGAIN..

Top
Page 2 of 2 <12


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

Who's Online
0 registered and 2419 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.067 seconds in which 0.032 seconds were spent on a total of 13 queries. Zlib compression enabled.

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