File Downloads

Ok well basically i’ve got this really annoying problem.
I found about needing the resoucres.lua file and adding all the content to download to it, however I want everything in the “/gamemodes/hui” directory to be downloaded so I made the resources.lua file like this:
[lua]
function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
	resource.AddFile(dir.."/"..v)
end

end

AddDir("/gamemodes/hui")
[/lua]

However it only downloads the files inside that folder, not the subdirectories inside.
So I changed it to this:

[lua]
function AddDir(dir) // recursively adds everything in a directory to be downloaded by client
local list = file.FindDir("…/"…dir…"/*")
for _, fdir in pairs(list) do
if fdir != “.svn” then // don’t spam people with useless .svn folders
AddDir(fdir)
end
end

for k,v in pairs(file.Find("../"..dir.."/*")) do
	resource.AddFile(dir.."/"..v)
end

end

AddDir("/gamemodes/hui")
AddDir("/gamemodes/hui/content")
AddDir("/gamemodes/hui/entities")
AddDir("/gamemodes/hui/gamemode")
AddDir("/gamemodes/hui/content/materials")
AddDir("/gamemodes/hui/content/Models")
AddDir("/gamemodes/hui/content/resource")
AddDir("/gamemodes/hui/content/script")
AddDir("/gamemodes/hui/content/settings")
AddDir("/gamemodes/hui/content/sound")
AddDir("/gamemodes/hui/entities/autorun")
AddDir("/gamemodes/hui/entities/effects")
AddDir("/gamemodes/hui/entities/entities")
AddDir("/gamemodes/hui/entities/weapons")
[/lua]

But now it downloads every single file on the server, even outside of the gamemodes.
So for example all the maps even though I didnt ask it to.

Please post what I’m doing wrong, how to fix it or an easier way.
Thanks in advance,