1

Is there a way to change file name valid characters, generally, and to prevent the use of spaces in files specifically? Preferably a log file and not a hack with inotify.

I have many non linux guys using our network file system and they are wreaking havoc on our naming conventions (FooBar.pdf, foo bar.pdf, foo_bar.pdf, Foobar.pdf, Foo-bar.pdf...)

5
  • How do they put/create files? Also your naming convention is probably not something that can be enforced only be automated technical tools. Feb 4, 2018 at 1:30
  • @PatrickMevzek files can be created/modified/destroyed either through Windows (it is mounted) or directly through the shell
    – puk
    Feb 4, 2018 at 1:34
  • 1
    Probably your best option is to publish a file naming convention that everyone is expected to adhere to, and then run a nightly or weekly cron job that emails each user a list of files owned by them which don't match...similar to cron jobs warning about quota usage. i.e. policy + automated nagging. If you want to keep track of whether users are renaming their files or not, you could generate each user's report as a file before mailing it (should do so anyway so you can avoid mailing people without any bad filenames) and store it in a git repo.
    – cas
    Feb 4, 2018 at 2:03
  • 1
    You are too short on specifications but what you could do is: 1) having one space openly available for people to create files it, separate from the true space, 2) having a process monitoring files arriving in previous space, checking name per your convention and 3) moving it to another space only if accepted (and eventually finding a way to alert initial poster if not), and this space should not be directly accessible to users. Feb 4, 2018 at 5:30
  • 1
    @Mezvek That would work in theory but in practice it would be a mess. If the directory where the files are moved if the naming convention meets the requirements isn't accessible to the users then how would they do anything with the files from that point on? Even a link wouldn't work as they still wouldn't have access to the original.. Besides, if they can access and use the files with the non-adherent names then what would they care since they'd just be able to use those files instead of being concerned with the directory that they can't access? Feb 4, 2018 at 5:50

1 Answer 1

3

There isn't any way to restrict or control the way that the users name the files. You can create a policy and notify users who don't adhere to it but there is no way to actually enforce it. Even if there were a way to do so or if you were to create a script to automatically rename the files (which would be more trouble than it's worth), it would make things worse when the users would inevitably have trouble finding their files as the names would have changed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.