Page 4 of 5 <12345>
Topic Options
#153826 - 2005-12-23 05:41 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
a little better
now i get this
Code:
c:\test.kix

C:\Program Files\pics from home
Deleting Files -> The system cannot find the file specified.
Removing the Directory -> The directory is not empty.
C:\Program Files\my profile.backup
Deleting Files -> The system cannot find the file specified.
Removing the Directory -> The Directory in not empty.
C:\Program Files\hotties
Deleting Files -> The system cannot find the file specified.
Removing the Directory -> The Directory in not empty.
C:\Program Files\tester
Deleting Files -> The system cannot find the file specified.
Removing the Directory -> The operation completed sucessfully.



no more "Access is Denied"

Top
#153827 - 2005-12-23 05:48 PM Re: Deleteing specified files
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
what you have in such dirs that it says can't find the file?
_________________________
!

download KiXnet

Top
#153828 - 2005-12-23 07:36 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well if you can't use a newer version of KiX then just SHELL out and use RD /S /Q for what you want to remove.

Files in use can not be removed though. Be quite careful too as any mistakes may render a system non bootable.
 
Always use some type of LEN or other command to verify you're not at the root of the drive.
 

Top
#153829 - 2005-12-23 10:25 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Still won't let me live that one down, eh Doc...

:-)
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153830 - 2005-12-23 10:42 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
LOL - no names mentioned. I've actually written my own complete code that did not check the length of the var and removed way too much data
Top
#153831 - 2005-12-24 12:35 AM Re: Deleteing specified files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Then there was my disastrous BBChecker uninstall that wiped out my entire HD.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153832 - 2005-12-24 12:42 AM Re: Deleteing specified files
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
I was waiting for that old memory to come alive.
iirc, it was about the uninstaller script and how it was called and les didn't talk to me for a while...
_________________________
!

download KiXnet

Top
#153833 - 2005-12-26 03:26 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
just a thought, what about deltree.exe

Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $File
For Each $File In ReadFile('\\szl-fs9ces1\roxio\delete_profiles.txt')
If Exist('C:\Documents And Settings\'+$File)
shell "deltree /y 'C:\Documents and Settings\$File'"
endif


this doesn't work
how do i shell a something that has quotes in the command?

Top
#153834 - 2005-12-26 03:31 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
shell 'deltree /y "C:\Documents and Settings\$File"'
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153835 - 2005-12-26 03:59 PM Re: Deleteing specified files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
shell 'deltree /y "C:\Documents and Settings\' + $File + '"'
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153836 - 2005-12-26 04:00 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Try again Rad

He is using:
$SO=SetOption('NoVarsInStrings','On')

Top
#153837 - 2005-12-26 04:01 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
oops I see Canada is up
Top
#153838 - 2005-12-26 04:03 PM Re: Deleteing specified files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There are a few FAQs on the use of SHELL and quotes.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153839 - 2005-12-26 04:25 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
i hate novars...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153840 - 2005-12-26 04:28 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
that doesn't seem to work, I also tried:
Run 'deltree /y "C:\Documents and Settings\$File"'

Top
#153841 - 2005-12-26 04:49 PM Re: Deleteing specified files
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
read on...
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#153842 - 2005-12-26 05:09 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
I can get it to work this way
shell 'deltree /y "C:\Documents and Settings\dir_to_delete"'
but i can't seem to get it to recognize $File


this works:
Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $File

shell 'deltree /y "C:\Documents and Settings\Dir_to_delete"'



this doesn't
Code:
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $File
For Each $File In ReadFile('\\Server\Share\delete_these_files.txt')
If Exist('C:\program files\'+$File)
shell 'deltree /y "C:\program files\' + $File + '"'
endif




Top
#153843 - 2005-12-26 07:22 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Well DELTREE is not a valid program on 2000/XP/2003 but the RD command is as I've shown before.

The following code should work just fine on Windows NT/2000/XP/2003 as long as the user has Administrator rights on the system and there are no files locking the profile.
 


 
Break On
Dim $SO
$SO=SetOption('Explicit','On')
$SO=SetOption('NoVarsInStrings','On')
$SO=SetOption('NoMacrosInStrings','On')

Dim $Profiles,$Profile,$BadProfiles,$File
$Profiles=ExpandEnvironmentVars(ReadValue('HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList','ProfilesDirectory'))
'Profiles are stored here: ' + $Profiles ?
$File = '\\szl-fs9ces1\roxio\delete_profiles.txt'
$BadProfiles = ReadFile($File)
'Reading profiles from ' + $File ?
'Read error: ' + @ERROR + ' ' + @SERROR ?
For Each $Profile In $BadProfiles
If $Profile
If GetFileAttr($Profiles+'\'+$Profile) & 16
'Bad Profile found: ' + $Profile ?
;Remove the semi-colon from the SHELL line below to actually delete the profile
If Len($Profiles+'\'+$Profile)>10
;SHELL '%COMSPEC% /C RD /S /Q ' + '"'+$Profiles+'\'+$Profile+'"'
EndIf
'Error removing profile: ' + @ERROR + ' ' + @SERROR ?
EndIf
EndIf
Next

Function ReadFile($file)
Dim $lf, $f, $_, $t
$lf=CHR(10)
$f=FreeFileHandle
$_=Open($f,$file)
If @ERROR Exit @ERROR EndIf
Do $t=$t+$lf+ReadLine($f) Until @ERROR
$_=Close($f)
$ReadFile=Split(SubStr($t,2),$lf)
EndFunction

 

Top
#153844 - 2005-12-26 07:25 PM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Quote:

i hate novars...






ROFL now - now ... That's just lazy coding. You're letting Ruud take up the slack for you inside the EXE.
 

Top
#153845 - 2005-12-27 12:16 AM Re: Deleteing specified files
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11624
Loc: CA
Quote:

can get it to work this way
shell 'deltree /y "C:\Documents and Settings\dir_to_delete"'





What operating systems are we talking about here? I certainly hope the Air Force or whomever is not still running Windows 95/98 systems in production.

DELTREE does not exist on my NT4/2000/XP/2003 systems so if it's working (semi-working) for you then we must be talking about a Windows 95/98/ME system which would mean the RD code I wrote would not work either as Windows 95/98 used a different switch as I recall.
 

Top
Page 4 of 5 <12345>


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

Who's Online
1 registered (Smitis) and 140 anonymous users online.
Newest Members
rrosell, PatrickPinto, Raoul, Timothy, Jojo67
17877 Registered Users

Generated in 0.125 seconds in which 0.083 seconds were spent on a total of 14 queries. Zlib compression enabled.

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