I was reading a fanfiction when they asked this specific question, and it make me think... Specifically what does he do in Hogwarts? In all the seven books, do they explain exactly what he does? In theory the house elves do almost all the work and the cleaning after all. If I'm not wrong the only thing he does is walk around with a cat. Do the books say if he does anything else? Or is he there only because Dumbledore had pity on him?
As the Hogwarts caretaker, Argus Filch does a variety of things:
General rule enforcement
Even worse than Peeves, if that was possible, was the caretaker, Argus Filch. Harry and Ron managed to get on the wrong side of him on their very first morning. Filch found them trying to force their way through a door that unluckily turned out to be the entrance to the out-of-bounds corridor on the third floor. He wouldn't believe they were lost, was sure they were trying to break into it on purpose, and was threatening to lock them in the dungeons when they were rescued by Professor Quirrell, who was passing.
Suddenly, Harry felt wide-awake. The whole of Hogwarts was open to him in this cloak. Excitement flooded through him as he stood there in the dark and silence. He could go anywhere in this, anywhere, and Filch would never know.
Maintain the trophy room
"You will be polishing the silver in the trophy room with Mr. Filch," said Professor McGonagall. "And no magic, Weasley – elbow grease."
Clean the castle
"You'd better get out of here, Harry," said Nick quickly. "Filch isn't in a good mood – he's got the flu and some third years accidentally plastered frog brains all over the ceiling in dungeon five. He's been cleaning all morning, and if he sees you dripping mud all over the place –"
Check Hogsmeade permissions
He accompanied them to the entrance hall, where Filch, the caretaker, was standing inside the front doors, checking off names against a long list, peering suspiciously into every face, and making sure that no one was sneaking out who shouldn't be going.
Restore damaged portraits
"Hiding in a map of Argyllshire on the second floor. Apparently she refused to let Black in without the password, so he attacked. She's still very distressed, but once she's calmed down, I'll have Mr. Filch restore her."
Repair the castle
Filch was suddenly bustling up and down the corridors, boarding up everything from tiny cracks in the walls to mouse holes.
Maintain a list of banned objects
"Mr. Filch, the caretaker, has asked me to tell you that the list of objects forbidden inside the castle has this year been extended to include Screaming Yo-yos, Fanged Frisbees, and Ever-Bashing Boomerangs. The full list comprises some four hundred and thirty-seven items, I believe, and can be viewed in Mr. Filch's office, if anybody would like to check it."
Set up furniture
Up at the staff table, Filch, the caretaker, was adding chairs
Patrol the corridors
and to patrol the corridors in shifts with Argus Filch, who suspected that the holiday spirit might show itself in an outbreak of wizard duels
Mete out punishments
But when Educational Decree Twenty-nine comes in, Potter, I’ll be allowed to do them things...
Watch secret passages
And Mr. Filch is observing all secret passages in and out of the castle. If I find a shred of evidence...”
"Oh no, of course you weren't, I forgot you were late. Well, Filch ran over all of us with Secrecy Sensors when we got into the entrance hall. Any Dark object would have been found, I know for a fact Crabbe had a shrunken head confiscated. So you see, Malfoy can't have brought in anything dangerous!"
Lock the castle
When he reached the entrance hall he saw that Filch had forgotten to lock the front door.
Various other tasks that come up
"...evacuation will be overseen by Mr. Filch and Madame Pomfrey.
Argus Filch is the caretaker of Hogwarts. Yes, he mostly roams the corridors, with his cat, looking to catch students breaking some rule or other. The article lists a large number of his activities. Mostly these involve getting James Potter and friends into trouble; getting Harry Potter and friends into trouble. He was a bit of a jack of all trades, and was pretty handy with hammer and step ladder as well. It's unclear whether he took his position at Hogwarts before or after Dumbledore became headmaster.