file creation

Hi,
Is there any way to restrict directories with one type of file creation.

regards.

Duplicate !!!!

Any update on this.

I am not sure what you understand about restriction about one type of file creation. Maybe you can explain a bit more what is behind that.

lets say one directory is there "\dat_files"

my question is dat_files should only contain *.dat files. if we try to create any file with with extension other than dat, the file should not create, it should give error.

First off, you use slashes / as separator for directories and files on Linux/Unix, not backslashes \ like on MS OS'es. I guess that was just a typo :slight_smile:
There is no restriction for any shell based command, that such files may not be created. You would have to write a front end or something your own, I guess.

Why is this so critical? Assuming as one possibility, can't your application that might read there just ignore all other kinds of files, that don't have the suffix/prefix you need or something like that?

i have a job which will pick all the files from a directory of same type and extension.( Ex: .dat or .ds). some user also mistakely creating files of different type and extension in that directory, which causes failure in the job. how to over come this problem so that user can't be able to create file of different type and extension.

you do one thing ..put a condition in your job that the files which are refering is actually created by you or not by checking the file owner. You can avoid the other users files by checkign the fileowner.

You could restrict access to the directory, or change you code to look just for .dat (or whatever) files the belong to just a certain user.

find /path/to/file -name '*.dat' -user username