Help needed with vbscript to delete all files and folders on desktop with exclusions
I'm very new to scripting but at work my director challenged me with writing a script that would scrub the desktop and my documents for any file and folder and delete it, however it needs to keep the shortcuts on the desktop.
I've peiced together some parts of other scripts I think do the job for the most part, but I need help understanding on how to exclude the .lnk files to be deleted... I was told that I would need to use an array and getfile function to make this work... please help!
On Error Resume Next
strPath = "c:\Documents and Settings\user\Desktop"
Set objShell = CreateObject("Wscript.Shell")
sCurrentDir = objShell.CurrentDirectory
Dim objFSO, objFolder
Set objFSO = CreateObject ("Scripting.FileSystemObject")
If objFSO.FolderExists(strFolderPath) Then
objFSO.DeleteFolder strFolderPath, True
Set objFSO = Nothing
msgbox "Desktop Reset Complete."