Link to home
Start Free TrialLog in
Avatar of tdemeyer
tdemeyerFlag for Belgium

asked on

Script to delete non-locked files and folders

Hi experts,

our users have their c:\temp folder cleaned everytime they login. This folder (and/or subfolders) may sometimes contain files that are in-use/locked by the OS. Up until now we used deltree.exe to clean up this folder. The program simply skipped the locked files.
With the introduction of W7 X64, deltree no longer functions. Some googling pointed us to del3.exe as alternative. Unfortunatly, this program exits after the first locked file/folder.

As our login script is VBS based, I'm looking for a procedure that can delete all files and subfolders in any given folder, skipping locked files/folders.

ASKER CERTIFIED SOLUTION
Avatar of sr75
sr75
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tdemeyer

ASKER

Thanks, needed some minor adjustments to fit our own script (due to option explicit), but works flawlessly.