0

I've spent literally > 40 hours trying to get this to work by various methods, including xcopy, and research on StackOverflow and untold numbers of other sites. I know DOS bat file basics, and am proficient with respect to Windows overall architecture (including registry editing), but this simple task has me at my wits' end. And this "deliverable" is now far overdue.

I'm currently trying ROBOCOPY. It seems to be very promising. Yet, the current iteration I have moves files but not folders.

Here's my code:

@ECHO OFF
cls

SET SOURCE=%USERPROFILE%\Desktop
SET DEST=%USERPROFILE%\Desktop\Archives
SET NOTTHIS=%USERPROFILE%\Desktop\Archives

robocopy %SOURCE% %DEST% /MOVE /DCOPY:T /XD %NOTTHIS% /W:1 /NP /LOG:C:\TEMP\robolog.txt

What am I missing?

Important note: ultimately the actual final destination is a subfolder of the <user-desktop>\Archives folder, e.g., <user-desktop>\Archives\29-may-2016-05-15-32\ the latter node (directory) being dynamically created with a date-timestamp naming. I have working code to create the target subfolder dynamically -- all I need to do is get robocopy to move FOLDERS and files, not just files, to my destination.

My stress level is 12 out of 10 at this point, any explicit help would be appreciated beyond words.

Ross Ridge
  • 38,414
  • 7
  • 81
  • 112
Saguaro
  • 11
  • 3
  • 3
    You're probably missing the `/E` (or maybe `/S`) option. – Ross Ridge May 27 '16 at 01:52
  • 2
    `cd "%source%"` then `robocopy . "%dest%" * /s /xd "%notthis%" /move` worked for me. Your `robocopy` command is missing not only the `/s` switch as Ross Ridge points out, but also the third argument, the file mask. – rojo May 27 '16 at 01:55
  • 1
    You can see an answer of mine to an identical question using `for` loops with `dir`, `move`, and `findstr`. http://stackoverflow.com/questions/37082540/dos-batch-script-works-almost-moving-selected-files-and-folders-off-the-desk/37083429#37083429 –  May 27 '16 at 04:23
  • If you want to *move* the files, why are you using *copy* functions? Moving is different to copying. Which are you trying to do? – Harry Johnston May 27 '16 at 06:16
  • 1
    And what exactly was wrong with the answers you received [the last time you asked this](http://stackoverflow.com/questions/37082540/dos-batch-script-works-almost-moving-selected-files-and-folders-off-the-desk)? – SomethingDark May 27 '16 at 06:23

0 Answers0