Solved

move command in dos

Posted on 2011-03-02
4
421 Views
Last Modified: 2012-05-11
im in the root folder. in this root folder are 10 subfolders. i want to move every that has a doc ext to a specific folder. how? is there a switch somewhere ? thanks

move *.doc e:\targetfolder\doc
0
Comment
Question by:miamiLAW
  • 2
4 Comments
 
LVL 11

Expert Comment

by:dekkar
ID: 35023928
Dont think move command has the capability...

I do know robocopy can.....

For example:

http://www.mydigitallife.info/2007/05/07/robocopy-syntax-command-line-switches-and-examples/


adding the /mov switch will delete copied files from the source.
0
 
LVL 51

Expert Comment

by:Bill Prew
ID: 35023951
Try this from the DOS command line:

for /r "c:\root" %A in ("*.doc") do move "%A" "e:\targetfolder\doc"

Open in new window

~bp
0
 
LVL 8

Expert Comment

by:PeteEngineer
ID: 35023962
@echo off
setlocal
set source=c:\sam\john
set dest=F:\backup
pushd "%source%"
for /f "delims=" %%a in ('dir /b /ad 2^>NUL') do move /Y "%%a" "%dest%"
for /f "tokens=*" %%a in ('dir /b /a-d 2^>NUL') do move /y "%%a" "%dest%"
popd
endlocal

Open in new window

0
 
LVL 8

Accepted Solution

by:
PeteEngineer earned 500 total points
ID: 35023965
if you want to move folders you have to use

XCOPY http://www.computerhope.com/xcopyhlp.htm

then use DELTREE on the old one.
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

One of my most closely kept secrets is revealed in this discussion How to output text on the same line This question was recently posted in EE by Simon336697 (http://www.experts-exchange.com/Programming/Languages/Scripting/Shell/Batch/Q_2459…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

743 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

12 Experts available now in Live!

Get 1:1 Help Now