|
server
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How to find all mp3 files and delete them
Hi,
I am searching for a script that I will use like a logon script in my domain /using GPO/ to search for mp3 files on the client computers and to delete them. I find some scripts but they do not work correctly or search only in one folder. I mean that they search only in C:\ in the root folder but not in the subfolders like Document and Settings where are stored the user accounts. I want a script that will search on all drives and folders. Thanks for any insight. Regards, You could certainly use the FileSystemObject and do a recursive search.
Although I've found FSO to not always work properly on Vista, probably due to its increased use of junctions. The other approach would be to use a WMI query and then delete each file as it is found. These types of queries can take some time to run so you might set it up as a computer start up script. That way it should keep running, even while and after the user has logged on. You would use a query like this: strtype="mp3" strDrive="C:" strQuery="Select Name,CreationDate,LastAccessed,LastModified," & _ "FileSize,Extension,Drive FROM CIM_DATAFILE WHERE Extension='" & strType & _ "' AND Drive='" & strDrive & "'" -- Show quoteJeffery Hicks Microsoft PowerShell MVP http://www.scriptinganswers.com http://blog.sapien.com Now Available: WSH and VBScript Core: TFM Coming Soon: Windows PowerShell: TFM 2nd Ed. "Daniel Ivanov" <Daniel Iva***@discussions.microsoft.com> wrote in message news:E21D226E-5969-4D89-9CED-4B66F6F9ECE5@microsoft.com... > Hi, > I am searching for a script that I will use like a logon script in my > domain > /using GPO/ to search for mp3 files on the client computers and to delete > them. I find some scripts but they do not work correctly or search only in > one folder. I mean that they search only in C:\ in the root folder but not > in > the subfolders like Document and Settings where are stored the user > accounts. > I want a script that will search on all drives and folders. > Thanks for any insight. > > Regards, > |
|||||||||||||||||||||||