Alex Gordon
Alex Gordon

Reputation: 60871

script to move all files from one location to another location

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

Upvotes: 2

Views: 13270

Answers (3)

dierre
dierre

Reputation: 7220

I think this one

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

should be corrected.

Upvotes: 2

Tim Coker
Tim Coker

Reputation: 6524

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

Upvotes: 2

tijmenvdk
tijmenvdk

Reputation: 1758

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.

Upvotes: 1

Related Questions