tags:

views:

184

answers:

2

Hi guys

my app actually goes to different folders and takes each file into account and reads each file and does a lot of processing on them and marks the folder it has processed as done. but this is not happening as the system is immediately generating files like .DS_store and .localized and .trash. so is there any mechanism to skip processing hidden files or stop the os from generating these files programatically?

Thanks

A: 

I'm not aware of any option that disables the generation of .DS_Store files locally. There is an option for remote, here.

Another way to do it could be to create a unix user for just that job and let him own the dirs, so that the Finder never can go there. Either start the job manually using sudo, or make it a setuid job.. or use launchd.

neoneye
Thanks neoneye for the reply. is there any way to identify if a file is os generated hidden file?or can you list files which are os generated for folders. i know three of them 1. .DS_Store2. .localized3. .trashAre there any other hidden files which are OS generated files for MAC.Thanks
King
There is also a .CFUserTextEncoding in the homedir. If you look in the root dir of a volume there are some more hidden files: 1. .fseventsd 2. .HFS+ Private Directory Data 3. .Spotlight-V100 4. TemporaryItems 5. \\\\HFS+ Private Data 6. .com.apple.timemachine.supported 7. .journal 8. .journal_info_block. Maybe you can have a text file for your program with filenames to ignore, so that you still can process dotfiles and ignore the apple system files.
neoneye
Also the hidden flag is only set on some of the files.
neoneye
+2  A: 

Couldn't you change your app to just ignore files that start with "."? You've tagged this Cocoa, so using something like NSFileManager's contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: seems appropriate. One of the options you can specify is NSDirectoryEnumerationSkipsHiddenFiles, which will skip hidden files. Check the documentation for more details.

Mark Bessey
Thanks Mark. But if i skip files which i start with '.' then all hidden files will be skipped even the files which are not generated by os. is there any method to identify if a file is os generated or not?
King
I guess that would depend on what you mean by "os generated". A lot of dot-files are generated by different parts of the OS. The Finder makes some, Spotlight search makes some others, Time Machine makes some, etc , etc, so there won't be a comprehensive list anywhere. A lot of third-party software makes hidden files, too. I think that you're going to have to make a list of "files to ignore" in your app. Make sure it's user-editable, too - some editors use dot-files for backups, and then there are .svn directories...
Mark Bessey
And for what it's worth, most of the command-line tools ignore hidden files unless they're specifically told to process them. Are you sure there are going to be hidden files that you want to process?
Mark Bessey