Page 2 of 5 <12345>
Topic Options
#153786 - 2005-12-22 02:12 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
try this:
change
Del 'C:\Program Files\'+$File

to:
? 'C:\Program Files\'+$File
Del 'C:\Program Files\'+$File
? @error +' '+@serror

also, does your people have local admin?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153787 - 2005-12-22 02:24 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
No, they are all regular users, but I can't get it to run for me either.
I'll make the changes and report back...

Top
#153788 - 2005-12-22 02:27 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
they will probably not have permission to delete those files then...
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153789 - 2005-12-22 02:32 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
A step in the right direction...well a direction anyway!!

This is the output I get when I run it in a dosbox
Code:
C:\test.kix

C:\Program Files\File1
2
C:\Program Files\
2
C:\
Top
#153790 - 2005-12-22 02:41 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
Do I need a comma or semicolon in delete_these_files.txt?

File1,
or
File1;

Top
#153791 - 2005-12-22 03:27 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
tried both the comma and the semicolon, they were just a step backwards
Top
#153792 - 2005-12-22 03:40 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
BTW... when you say file are you meaning folder

Be specific
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153793 - 2005-12-22 03:43 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
yea, sorry about that.
stupid question of the day: does that make a difference?

Top
#153794 - 2005-12-22 03:56 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
Del
Action: Deletes one or more files.
http://www.scriptlogic.com/Kixtart/htmlhelp/Commands/del.htm

RD
Action: Removes the directory specified.
http://www.scriptlogic.com/Kixtart/htmlhelp/Commands/rd.htm

and yes, it makes a difference
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153795 - 2005-12-22 04:00 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
and if they do not have admin, then they will probably have have the permissions to delete those files, unless the acls have been played with...

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

Top
#153796 - 2005-12-22 04:06 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
since GIGO has come up.

Are you just trying to remove installed programs by deleting the directories?
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153797 - 2005-12-22 04:07 PM Re: Deleteing specified files
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you clearly don't have a File1 in your program files folder if it says there is no such file in the error.
_________________________
!

download KiXnet

Top
#153798 - 2005-12-22 04:11 PM Re: Deleteing specified files
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Your file should specify full filenames with the extension

Also run it with debug so you can see exactly what it is doing at what point.
_________________________
Today is the tomorrow you worried about yesterday.

Top
#153799 - 2005-12-22 04:14 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
not trying to uninstall, just remove some directories
also i changed del to rd and now i get this output
Code:
c:\test.kix

C:\Program Files\Directory1
145
c:\Program Files
145
C:\
Top
#153800 - 2005-12-22 04:42 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
if you READ the links that I provided, RD only works on empty directories

so you will need to provide directory names in your file.
and do something like:

for each $d in readfile($file)
del "%programfiles%\"+d$+"\*.*" /s /c
rd "%programfiles%\"+d$ /q
next
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153801 - 2005-12-22 04:42 PM Re: Deleteing specified files
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
btw... as funny as it would be, make sure there are no blank lines in your text file.
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#153802 - 2005-12-22 04:43 PM Re: Deleteing specified files
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4672
Loc: The Netherlands
Error 145: The directory is not empty.
@SERROR would also show this

Have a look here for all error codes and a short explanation.
System Error Codes
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#153803 - 2005-12-22 05:30 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
thanks everyone for all your help, we're getting there!!!


now i get ERROR : undifined variable [$d]!
Line : 11

i tried changing the delete_these_files.txt to read $dDirectory
then i tried changing the $d in the scrip to $file and still no luck

Top
#153804 - 2005-12-22 05:38 PM Re: Deleteing specified files
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
heh, no, the $d is the file.
you have somewhere a dim $file line?
change that to $d.
_________________________
!

download KiXnet

Top
#153805 - 2005-12-22 05:43 PM Re: Deleteing specified files
matthewst Offline
Getting the hang of it

Registered: 2005-01-26
Posts: 89
so far i have this in my script
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)
? 'C:\Program Files\'+$File
for each $File in readfile($file)
del "C:\Program Files\"+$File+"\*.*" /s /c
rd "C:\Program Files\"+$File /q
next

? @error +' '+@serror
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



this in my delete_these_files.txt
Code:
$FileDirectory



and this is th output
Code:
C:\test.kix
c:\Program Files
-1
c:\


Top
Page 2 of 5 <12345>


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

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.078 seconds in which 0.026 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