#153786 - 2005-12-22 02:12 PM
Re: Deleteing specified files
|
Radimus
Moderator
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
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?
|
Top
|
|
|
|
#153787 - 2005-12-22 02:24 PM
Re: Deleteing specified files
|
matthewst
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
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
they will probably not have permission to delete those files then...
|
Top
|
|
|
|
#153789 - 2005-12-22 02:32 PM
Re: Deleteing specified files
|
matthewst
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
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
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
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
BTW... when you say file are you meaning folder
Be specific
|
Top
|
|
|
|
#153793 - 2005-12-22 03:43 PM
Re: Deleteing specified files
|
matthewst
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
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
|
|
Top
|
|
|
|
#153795 - 2005-12-22 04:00 PM
Re: Deleteing specified files
|
Radimus
Moderator
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
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
|
Top
|
|
|
|
#153796 - 2005-12-22 04:06 PM
Re: Deleteing specified files
|
Radimus
Moderator
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
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?
|
Top
|
|
|
|
#153799 - 2005-12-22 04:14 PM
Re: Deleteing specified files
|
matthewst
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
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
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
|
Top
|
|
|
|
#153801 - 2005-12-22 04:42 PM
Re: Deleteing specified files
|
Radimus
Moderator
![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif) ![*](/forums/images/general/default/star.gif)
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.
|
Top
|
|
|
|
#153803 - 2005-12-22 05:30 PM
Re: Deleteing specified files
|
matthewst
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
|
|
|
|
#153805 - 2005-12-22 05:43 PM
Re: Deleteing specified files
|
matthewst
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 149 anonymous users online.
|
|
|