I'm trying to delete a load of files owned by previously existing users. In other words I then need to "su [username] -c 'rm -r [dirname]' where [username] matches the owner of the files. (I don't have root access to the server but do have the ability to su to any of the users I need to delete files for.)
If I use "ls -l" I see the user names truncated to 8 chars, so I'm using "ls -ln" to see the numeric user ID of the files instead. However su doesn't work with numeric UID values.
So either I need to find a way to get the fullname of the owner (I know stat will do this but I have a lot these to do and I can't see a good way to just get a list), or find a way to map the UID to a name for su, or some other workaround I haven't thought of.
Suggestions?