[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

BATCH FILE FOR REMOVING A COMMON DIRECTORY NAME

Posted on 2015-01-08
6
Medium Priority
?
182 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
[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
  • 4
  • 2
6 Comments
 
LVL 25

Expert Comment

by:NVIT
ID: 40538901
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
ID: 40540278
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 25

Assisted Solution

by:NVIT
NVIT earned 2000 total points
ID: 40540378
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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 
LVL 25

Accepted Solution

by:
NVIT earned 2000 total points
ID: 40540393
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
ID: 40541201
Thank you for your time and expertise!
0
 
LVL 25

Expert Comment

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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

649 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