Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

delete folder on multiple computers

Posted on 2013-10-28
3
Medium Priority
?
395 Views
Last Modified: 2013-11-18
I need a script or program which can be used to delete a folder (C:\folder1) on multiple computers in our domain.
Could you please help me.
Most of my workstations are XP sp3
0
Comment
Question by:dedri
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 13

Expert Comment

by:Daniel Helgenberger
ID: 39606120
Use a domain admin account, and create a text file with one computername per line. You can easily do so with
net view>computers.txt

Open in new window

Then, run a script iterating over the file:
SET DELTEME=mydir
FOR /F "eol=;" %%M in (computers.txt) do (
     RMDIR /S /Q "%%M\c$\%DELTEME%"
)

Open in new window


The file would be on drive C: for instance, accessed via the admin share c$
0
 

Author Comment

by:dedri
ID: 39616109
the script gives an error:

C:\temp\ExecMC>(RMDIR /S /Q "computer1\D$\folder1" )
The system cannot find the path specified.

Probably we need to add somehow "\\" before computer name?
0
 
LVL 13

Accepted Solution

by:
Daniel Helgenberger earned 2000 total points
ID: 39616262
Probably we need to add somehow "\\" before computer name?
You assume correct if you did not generate the computer list as mentioned above. Please modify the script if you use plain names:
SET DELTEME=mydir
FOR /F "eol=;" %%M in (computers.txt) do (
     RMDIR /S /Q "\\%%M\c$\%DELTEME%"
)

Open in new window

Note, I just added the ''\\".
0

Featured Post

Optimum High-Definition Video Viewing and Control

The ATEN VM0404HA 4x4 4K HDMI Matrix Switch supports 4K resolutions of UHD (3840 x 2160) and DCI (4096 x 2160) with refresh rates of 30 Hz (4:4:4) and 60 Hz (4:2:0). It is ideal for applications where the routing of 4K digital signals is required.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a collection of issues that people face from time to time and possible solutions to those issues. I hope you enjoy reading it.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question