# Removing old files after rebuilding world



## dennylin93 (Jul 7, 2009)

I just rebuilt world, and I tried to use `$ cd /usr/src/ && make delete-old` to clean out obsolete files. I was prompted every time a file was about to be deleted. How can it be automated (the files are deleted without confirmation)? Typing "y + Enter" hundreds of times is quite exhausting and frustrating.


----------



## sverreh (Jul 7, 2009)

Maybe this works?

```
# yes | make delete-old
```


----------



## dennylin93 (Jul 7, 2009)

Thanks, I'll try it out next time I upgrade a system. Already typed "y + Enter" for all the prompts. :x


----------



## sverreh (Jul 7, 2009)

Let's hope it works. It depends to some extent on how the make command treats its standard input. However, if it doesn't work, you can always resort to a version of Expect (or expect) from the ports.


----------



## felix (Jul 7, 2009)

I make:

```
cd /usr/src/
make BATCH_DELETE_OLD_FILES=YES delete-old delete-old-libs
```


----------



## dennylin93 (Jul 8, 2009)

Just tried them both. They both work.


----------

