• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

move command in dos

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
miamiLAW
Asked:
miamiLAW
  • 2
1 Solution
 
dekkarCommented:
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
 
Bill PrewCommented:
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
 
PeteEngineerCommented:
@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
 
PeteEngineerCommented:
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now