I'm trying export csv (and other files) from numerous subfolders. These are archive folders that are being dropping dropped on our database server to be loaded. In any case I found two lines of code that work (or did work) but when loaded into a bat file or called by xp_cmdshell commands do not work.
These commands are intended to extract all the files located in multiple (hundreds) of sub directories. Again these work when I put them in the command prompt manually but not when called via bat(or cmd file) or xp_cmdshell from SQL-Server.
for /f "tokens=*" %a in ('dir /b /s /a-d "C:\SPSData\UTDB1_Stage1"') do @move "%a" "C:\SPSData\UTDB1_Stage1"
MOVE C:\SPSData\UTDB1_Stage1\ *\ * C:\SPSData\UTDB1_Stage1\