Page 1 of 1 1
Topic Options
#29747 - 2002-09-26 07:41 PM Help with deleteing files in User Profiles
NH411 Offline
Lurker

Registered: 2002-09-26
Posts: 3
Unfortunately I'm less than well versed in Kix Scripting, but here's what I'm trying to accomplish:

I need to delete specific INI files for all users of a workstation in both "Documents and Settings" as well as 95/98 "Windows\Profiles" directories. There is also a copy of the source INI file in "Program files\XYZ".

The Problem I'm running into is that most of the file deletion scripts I've found require you to name the directories your looking in instead of including all subdirectories...

Any ideas or help would be very much appreciated...

Thx,
Me

Top
#29748 - 2002-09-26 07:43 PM Re: Help with deleteing files in User Profiles
Chris S. Offline
MM club member
*****

Registered: 2002-03-18
Posts: 2368
Loc: Earth
What if you 'RD /s' in WinNT and 'Deltree' in Win9x?

Are you talking about deleting the directory or just the ini file?

[ 26. September 2002, 19:45: Message edited by: Chris S. ]

Top
#29749 - 2002-09-26 07:44 PM Re: Help with deleteing files in User Profiles
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
I have no wintendo to get the parameters of DEL there, however, see the /s switch:

code:
Microsoft Windows 2000 [Version 5.00.2195]
(C) Copyright 1985-2000 Microsoft Corp.

C:\>del /?
Deletes one or more files.

DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names Specifies a list of one or more files or directories.
Wildcards may be used to delete multiple files. If a
directory is specified, all files within the directory
will be deleted.

/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for archiving
- Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.

C:\>

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

Top
#29750 - 2002-09-26 07:48 PM Re: Help with deleteing files in User Profiles
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
What are you saying... that you don't know in what directory the INI is in?

It is possible to recurse the subdirs but there has to be a better way. Have you checked in the registry to see if the INI file location is pointed to there?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29751 - 2002-09-26 07:50 PM Re: Help with deleteing files in User Profiles
Radimus Moderator Offline
Moderator
*****

Registered: 2000-01-06
Posts: 5187
Loc: Tampa, FL
it is a sad day when lazy admins are too lazy to script.... [Big Grin]
_________________________
How to ask questions the smart way <-----------> Before you ask

Top
#29752 - 2002-09-26 07:55 PM Re: Help with deleteing files in User Profiles
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Just remember... "laziness is the mother of invention"

It's human nature to be lazy. That's why we invent things... to make life easier.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29753 - 2002-09-26 07:59 PM Re: Help with deleteing files in User Profiles
NH411 Offline
Lurker

Registered: 2002-09-26
Posts: 3
I have a working NT Shell script that deletes the INI files with a "%UserProfile% variable, unfortunately 95/98 doesn't support any Profile or Username variable. I need to delete the specific INI files and not the entire profile directory, the INI file is not referenced in the Registry.
Top
#29754 - 2002-09-26 08:16 PM Re: Help with deleteing files in User Profiles
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Profiles on Wintendos are not available from the logon script due to load order. If you want to effect them from a logon script then you need to push a link (to another script) to the RunOnce key in the registry.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#29755 - 2002-09-26 08:23 PM Re: Help with deleteing files in User Profiles
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
well, don't know for del...
but couldn't you go with deltree?
with it masked you can take care of those.

also some for looping with dir could do that...

 
_________________________
!

download KiXnet

Top
#29756 - 2002-09-26 08:31 PM Re: Help with deleteing files in User Profiles
NH411 Offline
Lurker

Registered: 2002-09-26
Posts: 3
BTW, Don't confuse Laziness with applying One's time wisely.
Top
#29757 - 2002-12-05 07:38 AM Re: Help with deleteing files in User Profiles
MCA Offline
KiX Supporter
*****

Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
Dear,

FYI about W9x environment.

The beste way of deleting an INI file in a W9x environment is by using deltree.
It is fast and search through all directories. Possible share-violations errors
are skipped.
INI files are always available and are always reachable. Only the registry in-
formation HKCU isn't available during logging on. Not available registry means
that your changes made by a logging on kixtart script will be gone, when logging
on process has been completed.

Very important to known about deltree command is:

a file with same filemask specification must be available in starting directory.
So when you are trying to delete f.e. kixtart.ini which is located somewhere
in the c:\windows directory you had to entry following commands in
your BATch file

code:
 @echo off
chdir c:\windows
c:
echo -dummy- >c:\windows\kixtart.ini
deltree /y c:\windows\kixtart.ini >nul
@echo off

Of course it can be implemented also as a kixtart script.

By using roaming profiles we advice you to run the command also on your server(s)
during a lazy moment in the night, when this INI file exists in some of them.
greetings.
_________________________
email scripting@wanadoo.nl homepage scripting@wanadoo.nl | Links | Summary of Site Site KiXforms FAQ kixtart.org library collection mirror MCA | FAQ & UDF help file UDF kixtart.org library collection mirror MCA | mirror USA | mirror europe UDF scriptlogic library collection UDFs | mirror MCA

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
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.064 seconds in which 0.026 seconds were spent on a total of 12 queries. Zlib compression enabled.

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