Solved

move command in dos

Posted on 2011-03-02
4
422 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 52

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The following is a collection of cases for strange behaviour when using advanced techniques in DOS batch files. You should have some basic experience in batch "programming", as I'm assuming some knowledge and not further explain the basics. For some…
Introduction: Recently, I got a requirement to zip all files individually with batch file script in Windows OS. I don't know much about scripting, but I searched Google and found a lot of examples and websites to complete my task. Finally, I was ab…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

895 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

11 Experts available now in Live!

Get 1:1 Help Now