Tech Support > Operating Systems > MS-DOS > how do I? moving files without overwriting and still suppresing prompt
how do I? moving files without overwriting and still suppresing prompt
Posted by billious on June 26th, 2008



<nobody@home.here.com> wrote in message
news:8h57645d07emshlbl8o28fn679anv0gcga@4ax.com...
I believe that a template for what you are looking for may be something
like: (one line)


for %%i in (a b c) do if exist \sourcedir\%%i*.* for %%q in
(\sourcedir\%%i*) do if not exist "\destdir\%%~nxq" if not exist
"\destdir\%%~snxq" ECHO move "%%~fq" \destdir\


Where the ECHO is for safety.


That is, for matching filenames (if they exist) make sure that neither the
long filename nor the short filename exists in the destination directory and
if neither exists, move the file.

I've observed however that wit certain "nasty" filenames (containing
multiple-% for instance) the move is skipped, and also that sometimes the
file is COPIED, not moved - which I've seen before with the MOVE command.