las1313 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 email@example.com
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 ) )
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this
site. Computing.Net and Purch hereby disclaim all responsibility
and liability for the content of Computing.Net and its accuracy.