Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
in a batch file, i would like a text file to keep appending to itself until there is no more room left on the disk.
currently I am using type to append:
type file.txt >> file.txtI would like this to keep looping until the disk is full. I tried to use "if not errorlevel", but my DOS doesn't have an XCOPY (and I can't add XCOPY to the disk. long story) and a regular COPY doesn't seem to set an errorlevel when the disk is full.
So right now, when I run the batch, the file keeps appending to itself until the disk is full. Then it starts spitting out the "Insufficient Disk Space" message in this infinite loop. Is there any way I can stop the loop when this "Insufficient Disk Space" is given? Or is there a command besides XCOPY which will set an errorlevel when the disk is full?
BTW, I can't use any user inputs to stop the loop. It must all be automatic.
Thanks in advance.

Seems very odd that copy does not set errorlevel.
Try this:
::== FILLerUP.bat
@echo off
:loop
dir file.txt|find "FILE.TXT">before
type file.txt >> file.txt
dir file.txt|find "FILE.TXT">after
fc before after>nul
if errorlevel 1 goto :loop
:: DONE
If at first you don't succeed, you're about average.M2

I'm curious as to why you'd want to fill up the disk space. Just wundrin...
Life is more painless for those who are brainless.

Hi Jennifer,
me too
=====================================
If at first you don't succeed, you're about average.M2

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |