When it is false the '-A $file' returns null (which is considered a string). You can use this code to correct it:
if (-A $file || 0 > 30)
The '||' will use 0 to do the compair if -A $file is null (and no more warning).
Update: I don't know why I missed this (thanks to the people below who brought it up). '-A $file' is returning false because you are getting a directory listing for a directory and then checking the files in the current directory. Use this if statement:
if (-A "$dirPath\\$file")
Then you don't even need the '|| 0'.