Page 1 of 1 1
Topic Options
#187430 - 2008-05-02 12:25 AM Deleting a specific file at login
Aaron Perrault Offline
Fresh Scripter

Registered: 2003-08-29
Posts: 27
Loc: Emeryville, CA
Hi everyone,
I am looking for some assistance. I need to add something to our logon scripts. I am pretty sure that it will be relatively easy, but I am at a loss, and under the gun.

We are going through an email migration, so we need to delete a file with the extension .NK2 from the following location:

c:\documents and settings\%username%\application data\microsoft\outlook\

If this file exists, we just want to delete it. If the file doesn't exist, or the profile is named slightly different, just go ahead and end the script and proceed with logon. If it could create a text file at the same location called Success.txt that would be great, but not really necessary.

Any assistance would be greatly apprecaited.

thanks

app

Top
#187432 - 2008-05-02 01:10 AM Re: Deleting a specific file at login [Re: Aaron Perrault]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Basically the same question asked just yesterday... see:
http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=187393#Post187393
_________________________
(... better days ahead)

Top
#187438 - 2008-05-02 05:18 PM Re: Deleting a specific file at login [Re: Allen]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
; Try :-

If Exist("c:\documents and settings\%username%\application data\microsoft\outlook\Default Outlook Profile.NK2")

Del ("c:\documents and settings\%username%\application data\microsoft\outlook\Default Outlook Profile.NK2"

Endif

; Regards,

; Bill
_________________________
Bill

Top
#187442 - 2008-05-02 06:36 PM Re: Deleting a specific file at login [Re: BillBarnard]
Allen Administrator Offline
KiX Supporter
*****

Registered: 2003-04-19
Posts: 4572
Loc: USA
Make sure to remove the "(" on the del line, or you will have problems.
_________________________
(... better days ahead)

Top
#187450 - 2008-05-02 09:58 PM Re: Deleting a specific file at login [Re: Allen]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Quite similar code, just using a Registry read instead.

 Code:
$nk2=ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders', 'AppData')
If Exist($nk2+'\Microsoft\Outlook\*.nk2')=1  ;Searches for files ending with .NK2 and deletes them.
  Del($nk2+'\Microsoft\Outlook\*.nk2')
EndIf


Top
Page 1 of 1 1


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

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.065 seconds in which 0.036 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