Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Deleting the same sub folder from multiple root folders - possible?  (Read 2645 times)

0 Members and 1 Guest are viewing this topic.

cephian

  • Guest
Does someone know of a way to automate (either batch files or software) the deleting the same directory from multiple root directories?

For example:

I want to delete a subfolder called "Apple".

The "Apple Directory" exists under directories called "Orange" and "Banana".  So my goal is to delete Apple without deleting the root folders "Orange" and "Banana".

I need to automate this because I actually have to delete the same subfolder from over 200 root directories on a weekly basis.

Thanks for any all help!

Cephian

DaveLembke



    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Deleting the same sub folder from multiple root folders - possible?
« Reply #1 on: December 09, 2008, 10:44:39 AM »
I would use a batch file to do this.

If you know the exact given locations of multiple instances of APPLE you can path to it in a batch like below and use the RD  /Q/S to remove them and all data and directories contained within them.

@echo. Batch to remove APPLE from 2 known locations

RD /q/s "C:\program files\apple"
RD /q/s C:\quicktime\apple

Note: " " required where there are any spaces in the path like "Program Files", and 'q' is quiet mode and 's' includes deletion of everything from Apple on into the tree.

*** The batch above if copy and pasted into notepad and saved as say remapple.bat and run will remove Apple from Program Files, and the second one only if that path exists. It is strongly advised that you use a UNINSTALLER to remove unwanted programs, but if you want to simply delete all the APPLES this is an easy way with known locations. If the locations are unknown, then you will want a FOR loop to search the entire drive and run RD /q/s on detections of APPLE directory. More complicated and somone in the batch forum may be able to code it up quickly for you. I am a Batch Novice and frequently visit the DOS Batch forum for advice.

I cant believe you have 200 references to APPLE on a single computer? Where you trying to state that you have multiple workstations with APPLE on them and need them removed. IF so a simple batch will not work for performing operations triggered from one location across the network without 3rd party software to allow for this remote execution. If this is the case I would code up the easy version if say 10 paths on 20 computers and put the batch in the startup folder of windows so upon every start up it will search and destroy them for you. This would be installed to all 20 computers in the startup directory of Windows.

Good Luck!