0

I'm trying to move a directory which certain date parameter to another directory.. This is the command I'm using: FORFILES -p C:\test1\ /S /D -3 /C "cmd /c if @isdir == TRUE move C:\test2\"

I want to move subdirectories inside test1 to the test2 directory if they meet those parameters. Right now, the script will move test2 to test1.... why is that?

Shlomi
  • 321
  • 2
  • 6
  • 17

1 Answers1

0

If you only give the move command one parameter, it moves the given file/directory to the current directory. You need

FORFILES -p C:\test1\ /S /D -3 /C "cmd /c if @isdir == TRUE move @path C:\test2\"

so that move knows what file/directory (in @path) it should be trying to move.

DerfK
  • 19,313
  • 2
  • 35
  • 51
  • Hi, Ok it worked, but 1 problem, if I have subdirectories under 'test1', it will only move files from 1 subdirectory, the other subdirectories he get 'cannot find the file' 1 dir(s) moved. ERROR: The system cannot find the file specified – Shlomi Mar 29 '17 at 18:29