in reply to Need help with unlink error

Try to move your unlink inside your if (@files) { block. It seems like, from a logical standpoint, that's where you would want it. Why would you want to call unlink on an empty list?