views:

41

answers:

3

can someone help me with a dos script to move all files from one location to another location

+1  A: 
move <sourcepath>\*.* <destpath>

IE, if you wanted to move all files from c:\test\ to c:\test2

move c:\test\*.* c:\test2

if you want to suppress the prompt to overwrite files

move /Y c:\test\*.* c:\test2

If you want to move from the current directory, you can specify just the *.*. Also you can do relative paths. So if you want to move the current directory's files up one directory, you'd do

move *.* ..

.. being the shortcut for "up one directory"

If it's across the network, you can use a UNC path to authenticate as the user you're logged in as or map a drive (using the NET USE command) to specify a username/password on the remote computer, then copy using that drive letter. You can then delete the drive letter after you're done. UNC paths look like \\computer\share\folder\file.txt

Tim Coker
I think you mean across the network, not across the directory.
Larry Wang
yup, thanks. :)
Tim Coker
+2  A: 

I think this one

C:\> MOVE /Y *.* C:\Destination

should be corrected.

dierre
this is correct
I__
i accidentally marked it down, please edit it, and iw ill mark it back up
I__
Ok, I've edited it.
dierre
NIIIIIIIIIIIIIIIICE
I__
+1  A: 

Use Robocopy. In Windows 7 and Windows Server 2008 R2 you can even run it multi-threaded using the /MT[:n] switch. From my daily "sync-before-shutdown" script:

Robocopy "d:\dev" "\\dolores\backups\carrie\dev" /e /MT /njh /njs /nc /np /nfl /ndl

(all the /n.. switches suppress console output which helps to speed up the copying process).

To move the files, use either /MOV or /MOVE (to move all subfolders) instead of /E.

tijmenvdk