edited 2015-09-16 - the original answer remains below
The code is reformatted to avoid deleting unwanted folders when display fails. Only if pushd is being executed is deletion performed.
set "folder=\\SERVERNAME\Publish" pushd "%folder%" && ( for /d %%i in (*) do rmdir "%%i" /s /q popd )
original answer:
set "folder=\\SERVERNAME\Publish" pushd "%folder%" for /d %%i in (*) do rmdir "%%i" /s /q popd
pushd will create a disk mapping along the unc path and then change to it. Then all operations are performed on the disk: \ folders. At the end of popd will be deleted.
MC ND source share