19938

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

Answer1:

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

Answer2:

I think this one

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

should be corrected.

Answer3:

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.

Recommend

  • pushd \\\\network\\path returns CMD does not support UNC paths as current directories
  • transparent access to files on Samba shares on Linux et al. using C++ IO streams
  • How can I get a list of all open named pipes in Windows and avoiding possible exceptions?
  • How to get minimal absolute path from relative path without any permission checks?
  • Getting rollback in creating shortcuts on installation of node js in windows 7
  • Slim Framework Method not allowed. Must be one of: POST (405)
  • Which JQuery document.ready is better? [duplicate]
  • Office365 authentication without login redirection
  • Add the % on tab when working with HAML on vim
  • Intellij Idea Terminal shortcut not working
  • AWS Cognito- get user information with ID
  • Add log separators to all fixtures in unittests
  • Laravel 5.2 Auth::check() on exception pages (layouts)
  • why 0.1+0.2-0.3= 5.5511151231258E-17 in php [duplicate]
  • Emit new line in Inno Setup preprocessor
  • Accessing local repository in offline mode
  • How to make SASS put relative paths in its output
  • How to load Q library with Require.js?
  • ASP.NET windows authentication should always ask for credentials
  • Authentication failed with Azure Active Directory in Windows Phone
  • Private IP address in reserved subnet range
  • TFS 2015 - Waiting for an agent to be requested
  • Sort List of Strings By Version
  • Checking free space on FTP server
  • Handling un-mapped Rest path
  • Paperclip, set path outside of rails root folder
  • How to make a tree having multiple type of nodes and each node can have multiple child nodes in java
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • ILMerge & Keep Assembly Name
  • Symfony2: How to get request parameter
  • Run Powershell script from inside other Powershell script with dynamic redirection to file
  • Error creating VM instance in Google Compute Engine
  • Memory offsets in inline assembly
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Running Map reduces the dimensions of the matrices
  • Android Heatmap on canvas or ImageView
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF
  • How do I use LINQ to get all the Items that have a particular SubItem?