Solved

move command in dos

Posted on 2011-03-02
4
423 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 53

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

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

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

Using dates in 'DOS' batch files has always been tricky as it has no built in ways of extracting date information.  There are many tricks using string manipulation to pull out parts of the %date% variable or output of the date /t command but these r…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

810 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