Right now: Live recording of the Tech Support Guy Show!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express php pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
DOS/PDA/Other
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Operating Systems > DOS/PDA/Other >
Move Folders


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
TechnoBlast's Avatar
Member with 55 posts.
 
Join Date: Mar 2005
Experience: Advanced
17-Mar-2008, 12:30 PM #1
Question Move Folders
I know how to move files, but what is the DOS command to move foldes?

For example, I have folders and files in the c:\sam\john directory. I want to move all the files and folders that are located in the JOHN directory into F:\backup directory.

Thanks.
devil_himself's Avatar
Distinguished Member with 4,817 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
17-Mar-2008, 02:05 PM #2
Here Ya Go

Code:
@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
TechnoBlast's Avatar
Member with 55 posts.
 
Join Date: Mar 2005
Experience: Advanced
17-Mar-2008, 02:16 PM #3
Quote:
Originally Posted by devil_himself View Post
Here Ya Go

Code:
@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
Thanks for the code.

Looks like it partially worked. Only the files were moved. The folders stayed in place. When I execute it I get an "Access is denied" message.

Any ideas?
devil_himself's Avatar
Distinguished Member with 4,817 posts.
 
Join Date: Apr 2007
Location: India
Experience: Advanced
17-Mar-2008, 08:56 PM #4
Which Os ?
DaveBurnett's Avatar
Computer Specs
Distinguished Member with 4,471 posts.
 
Join Date: Nov 2002
Location: Tamworth, UK
Experience: If I don't know, I RTFM
18-Mar-2008, 07:42 AM #5
see XCOPY http://www.computerhope.com/xcopyhlp.htm

then use DELTREE on the old one.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 10:57 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.