I’ve got a directory with subdirectories that contain files like:
I’m trying to make every even numbered file contents the same as the odd numbered file before that.
So far I got to this to delete every second/even file:
<code>@echo off
setlocal
for /r %%D in (.) do (
set "z=0"
for /f %%F in ('dir /b "%%D*.blob"') do 2>nul set /a "z+=1, 1/(z%%2)" || del "%%D%%F"
)
</code>
<code>@echo off
setlocal
for /r %%D in (.) do (
set "z=0"
for /f %%F in ('dir /b "%%D*.blob"') do 2>nul set /a "z+=1, 1/(z%%2)" || del "%%D%%F"
)
</code>
@echo off
setlocal
for /r %%D in (.) do (
set "z=0"
for /f %%F in ('dir /b "%%D*.blob"') do 2>nul set /a "z+=1, 1/(z%%2)" || del "%%D%%F"
)
And this to duplicate all files:
<code>for /R %%f in (*.blob) do copy "%%~f" "%%~dpnf - copy %%~xf"
</code>
<code>for /R %%f in (*.blob) do copy "%%~f" "%%~dpnf - copy %%~xf"
</code>
for /R %%f in (*.blob) do copy "%%~f" "%%~dpnf - copy %%~xf"
I tried to then give the duplicated files the proper names, but I can’t get it to work.
Any suggestions?
New contributor
Defoq Nino is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1