Solved

BATCH FILE FOR REMOVING A COMMON DIRECTORY NAME

Posted on 2015-01-08
6
146 Views
Last Modified: 2015-01-09
Can someone please write a batch file to remove the directory: arch.

This is a common directory name I use for my job folders and I need to remove it and al it's contents from past jobs to gain storage space.

I am using windows 7 pro.

thank you.
0
Comment
Question by:stevedantonio
  • 4
  • 2
6 Comments
 
LVL 23

Expert Comment

by:NVIT
Comment Utility
e.g. if arch is in...
c:\arch

then in  CMD prompt...

rd /q /s c:\arch

Open in new window


In a RD_Arch.bat file...
@echo off
rd /q /s c:\arch

Open in new window

0
 

Author Comment

by:stevedantonio
Comment Utility
THIS COMMAND ONLY REMOVES ONE SPECIFIC DIRECTIORY:  rd /q /s c:\arch

CORRECT?

I NEED IT TO SCAN ALL DIRECTORIES AND REMOVE ANY DIRECTORY NAMED "ARCH"

THANK YOU
0
 
LVL 23

Assisted Solution

by:NVIT
NVIT earned 500 total points
Comment Utility
This will remove only ARCH folders is c:\. Do you need it to search other folders?

@echo off
for /d %%a in ("c:\*arch*") ECHO rd /q /s %%a

Open in new window


To run it for real, remove the ECHO after you've tested it and it looks fine.
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
LVL 23

Accepted Solution

by:
NVIT earned 500 total points
Comment Utility
This one searches all folders:

@echo off
for /f "tokens=*" %%a in ('dir /b /s /ad "c:\*arch*"') do ECHO rd /q /s "%%a"

Open in new window


If folders are strictly named ARCH, change it to:
@echo off
for /f "tokens=*" %%a in ('dir /b /s /ad "c:\arch"') do ECHO rd /q /s "%%a"

Open in new window

0
 

Author Closing Comment

by:stevedantonio
Comment Utility
Thank you for your time and expertise!
0
 
LVL 23

Expert Comment

by:NVIT
Comment Utility
You're welcome, Steve. Glad it worked for you. Have a nice weekend. Aloha!
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

771 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now