|
#1
|
|||
|
|||
|
Batch to rename files?
I need to find 0KB files in a directory, then replace the file with a pre-designated template file (blank.tif) but retain the file name. For instance, c:\temp contains test.tif and test1.tif, both with 0KB file sizes. The batch file would go in, grab blank.tif from c:\temp\replace (already set up), copy it to c:\temp but renaming it to test.tif and test1.tif (the size would remain the same from c:\temp\replace.)
I have a partially effective batch right now that finds and renames 0KB files, but need some help to relicate the desired behaviour described above. Any ideas? Here is the batch right now: @echo off setlocal set FileMask=*.* set LogFile=C:\temp\FindZero.log set Size=0 if exist "%LogFile%" del "%LogFile%" set Count=0 echo Searching for files of %Size% bytes size ... for /r %%a in ("%FileMask%") do if %%~za==%Size% ( echo %%a >>"%LogFile%" echo %%a set /a Count+=1 ) ren *.txt *.jpg echo %Count% files found.
|
![]() |
| Bookmarks |
«
Previous Topic
|
Next Topic
»
| Topic Tools | |
|
|
All times are GMT +1. The time now is 08:03 PM.
[
RSS ]








