Need util to move with rename dupes

Microsoft Windows xp pro with sp3 multil...
February 18, 2010 at 10:59:14
Specs: Windows XP
Can anyone suggest a util or batch command to move files from DirA to DirB with RENAME only if filename exists eg; file.xls becomes file(1).xls and the next time file(2).xls
Thanks,
Larry
lstorey1274@gmail.com

See More: Need util to move with rename dupes

Report •


#1
February 18, 2010 at 16:09:53
here's something to start with, maybe:
(haven't had time to test it yet)
@echo off & setlocal enabledelayedexpansion
pushd dir1
for /f %%a in ('dir c:\dir2' ^|find "File(s)') do (
if %%a equ 0 move c:\dir1\*.xls c:\dir2
goto :eof
)
for %%a in (*.xls) do (
call :mov
)
goto :eof
:mov
for /L %%b in (0 1 1000) do (
if not exist c:\dir2\%%a_%%b.xls (
move %%a c:\dir2\%%a_%%b.xls
goto :eof
)
)

Report •
Related Solutions


Ask Question