Options

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

SmallguySmallguy Member Posts: 597
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

  • Options
    tierstentiersten Member Posts: 4,505
    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.
  • Options
    RobertKaucherRobertKaucher Member Posts: 4,299 ■■■■■■■■■■
    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.
  • Options
    tierstentiersten Member Posts: 4,505
    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.
  • Options
    blargoeblargoe Member Posts: 4,174 ■■■■■■■■■□
    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: 11/2019 - RHCSA (RHEL 7); 2/2019 - Updated VCP to 6.5 (just a few days before VMware discontinued the re-cert policy...)
    Working on: RHCE/Ansible
    Future: Probably continued Red Hat Immersion, Possibly VCAP Design, or maybe a completely different path. Depends on job demands...
  • Options
    SmallguySmallguy Member Posts: 597
    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.