I want to move all the files and folders inside the folder "C:\Foldertest\" into the folder "C:\Foldertest\target".

And whenever I run this command, it does this for all files and folders except for the "C:\Foldertest\target" folder.

enter image description here

  • 1
    to be cut? What does that mean? – Andreas Aug 24 '18 at 18:52
  • Copy all the files inside the "C: \ Foldertest" folder to the "C: \ Foldertest \ target" folder, and delete it from the "C: \ Foldertest" folder. – mohammad takin Aug 24 '18 at 18:58
  • What's the problem? Select all the files except the target folder, then cut and paste into the target folder. Why use cmd? – AFH Aug 24 '18 at 19:25
  • I want to happen with file "file.bat" every 3600 seconds. I need this command. – mohammad takin Aug 24 '18 at 19:49
  • Possible duplicate of cmd move - move a couple of files – Nordlys Jeger Aug 24 '18 at 20:58

RoboCopy would be the preferred method:

Robocopy C:\FolderTest\ c:\FolderTest\Target /E /ZB /MOVE /MOT:60
  • Note the trailing backslash in the source folder
    • Failing to include this would copy C:\FolderTest, rather than it's contents

  • /E: Copy subdirectories, including empty ones
  • /ZB: Use restartable mode; if access denied use backup mode
    • Requires user to be added to Backup Operators group, else change to /Z
  • /MOVE: Move files and dirs (delete from source after copying)
  • /MOT: Monitor source; run again in X minutes, if changed
    • You could also utilize /MON:1
      • /MON: Monitor source; run again when more than X changes seen
|improve this answer|||||
  • ERROR : You do not have the Backup and Restore Files user rights. ***** You need these to perform Backup copies (/B or /ZB). ERROR : Robocopy ran out of memory, exiting. ERROR : Invalid Parameter #%d : "%s" ERROR : Invalid Job File, Line #%d :"%s" – mohammad takin Aug 27 '18 at 17:25
  • You can either add the user to the Backup Operators group, or change /ZB to /Z. I've updated my answer with the aforementioned. – JW0914 Aug 28 '18 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.