-2

i have the following t-sql to move files from 1 directory to another.

I tried both versions. job step succeeded with no errors, but files do not move.

any thoughts/suggestions?

EXEC xp_cmdshell  ' Move /Y "C:\SomeFiles\" "C:\SomeFiles\FileArchive\" ';

EXEC xp_cmdshell ' Move C:\SomeFiles\ C:\SomeFiles\FileArchive\ ';

1
  • Did you try running your command manually, outside SQL Server?
    – mustaccio
    Sep 23 at 15:45

1 Answer 1

1

Its because C:\SomeFiles\FileArchive\ is a Sub-Directory of C:\SomeFiles. Try running the command from a command prompt to test.

move /Y C:\SomeFiles\*.* C:\SomeFiles\FileArchive\

Will get you what you want.

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.