script to move all files from one location to another location

落爺英雄遲暮 提交于 2019-12-12 17:19:05

问题


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


回答1:


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




回答2:


I think this one

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

should be corrected.




回答3:


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.



来源:https://stackoverflow.com/questions/3259074/script-to-move-all-files-from-one-location-to-another-location

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!