Go Back   Cyber Tech Help Support Forums > Operating Systems > Windows NT, 2000, 2003

Notices

Reply
 
Topic Tools
  #1  
Old June 4th, 2004, 04:17 AM
RJMacReady RJMacReady is offline
New Member
 
Join Date: Jun 2004
Posts: 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.
Reply With Quote
Reply

Bookmarks

Topic Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:03 PM.

[ RSS ]