Question : Script to delete same file from multiple folders

I have a task to delete a file from multiple folders. To be more specific Lotus Notes has a file called perweb.nsf that continues to grow until it is deleted and then re-created. One copy exists in the users' home folder for every user we have in our domain which is in the hundreds. I am looking for some suggestions to write a script to delete this one file from each user directory.

Answer : Script to delete same file from multiple folders

If you want to delete all instances of the file under a particular directory, regardless of what subdirectories they're in, then a simple DEL /S should do it.

Paste the script below into a text file with a .cmd extension.  Customize the value of the "root" variable with the location of the users' home folders.  Running the script will delete all instances of the file from that folder and any subdirectories.

As with any delete command, test this carefully before using in a production environment.

1:
2:
3:
4:
5:
6:
7:
@echo off
setlocal
 
REM The folder containing the users' home folders.
set root=d:\home folders
 
del "%root%\perweb.nsf" /s
Open in New Window Select All
Random Solutions  
 
programming4us programming4us