Control characters used in a file name.windows 2k3 server

SmallguySmallguy Posts: 597Member
is there a way to lock down the characters that a user can have for a file name?

also is there a way to lock down the file name length?

I've seen issues with windows and long paths to a file..... over 255 characters


back ground is someone asked if we can write them a custom program to stop users form using special characters in file names.

Comments

  • tierstentiersten Posts: 4,505Member
    No. Not without some horrendous hack involving patching or hooking the syscalls in the kernel & filesystem as you'd need to get in there at a very low level to stop this.
  • RobertKaucherRobertKaucher Posts: 4,298Member
    tiersten wrote: »
    No. Not without some horrendous hack involving patching or hooking the syscalls in the kernel & filesystem as you'd need to get in there at a very low level to stop this.
    An easier solution would be a Windows based service that responds to the event of a file being saved in certain directories and then modifies the name based on regular expressions.

    Another would be a PowerShell script that runs every so often and then modifies the file names based on regular expressions.

    As Tiersten has stated, these are hacks, but are simpler than what Tiersten mentioned. But with the drawback of being limited to specific folders.
  • tierstentiersten Posts: 4,505Member
    Why do you want to restrict the filenames anyway? You have some sort of auditing or backup process that barfs when it gets an unusual or long filename?

    Restricting the path length is difficult anyway. Say you have 2 long nested directory trees. Each one individually is fine but somebody now drags 1 tree into the one. How do you handle that?
    As Tiersten has stated, these are hacks, but are simpler than what Tiersten mentioned. But with the drawback of being limited to specific folders.
    Yeah. I'm thinking of something that would completely prevent you from ever creating any files that violate the rules.
  • blargoeblargoe Posts: 4,165Member ■■■■■■■■■□
    You might could cobble some rules together using File Server Resource Manager in Windows 2008. It's really more for file types/extensions, but you might be able to create rules for the file name... not sure.

    That is an odd request you received.
    IT guy since 12/00

    Recent: 1/29/2018 - Passed 70-743 - MCSA 2016 Complete; 1/13/2018 - Passed 70-411 - MCSA 2012 complete
    Working on: Being a better coder, build/test/deploy automation fundamentals
    Future: Renew VCP (due 2/2019), possibly with an adjacent VCP or VCAP
  • SmallguySmallguy Posts: 597Member
    I assumed it was pretty much a no go

    we just have a new person at a company we support who wants OT change the world and makes all kinds of suggestions...came form another company with hundred of people in IT and programming teams... infrastructure departments... admins who only do email or print servers etc not a company with a half dozen over run people

    this was one of them

    we countered with why not make a policy for file naming stating do not use special characters
Sign In or Register to comment.