Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

In my user folder is a file with the name "1". When I open it in a text editor like Xcode, there is one line of text that reads:

button returned:OK

If I delete that file, it gets recreated after some time. My OS is 10.6.8

What is that file?

share|improve this question
1  
Looks like a log file of some kind, but without further information it's nearly impossible to find out where it's coming from. –  patrix Sep 6 '12 at 17:04
add comment

2 Answers

up vote 5 down vote accepted

It's impossible (given the information in your question) to know what is making the file, but you can set a trap for it and see what process is writing to that file and hopefully which one re-creates it if you catch that moment in the filesystem logging.

You'll need to know a few things about the terminal to use the tool fs_usage and filter the results to match the exact path of the file.

On my machine, my home folder is named mike, so you can adjust the |grep /Users/mike/1 command to match your user folder's name:

Open the terminal app and type pwd and press return. Then type the sudo command - this invokes the command as the super user (root) since it's tapping into the very lowest level of the system and bypasses the protections that all users have. If you don't like terminal commands, look into a tool like fseventer to see if you can determine what is creating that file.

mac:~ mike$ pwd
/Users/mike
mac:~ mike$ sudo fs_usage | grep /Users/mike/1
12:48:19  stat64            /Users/mike/1                                                                    0.000076 W touch       
12:48:19  open              /Users/mike/1                                                                    0.000206 W touch       
12:48:19  getattrlist       /Users/mike/1                                                                    0.000119   mds         
12:48:19  lstat64           /Users/mike/1                                                                    0.000012   mdworker    
12:48:19  stat64            /Users/mike/1                                                                    0.000004   mdworker    
12:48:19  lstat64           /Users/mike/1                                                                    0.000002   mdworker    
12:48:19  getattrlist       /Users/mike/1                                                                    0.000041   mdworker    
12:48:19  open              /Users/mike/1                                                                    0.000025   mdworker    
12:48:19  getattrlist       /Users/mike/1                                                                    0.000012   mdworker    
12:48:19  getattrlist       /Users/mike/1                                                                    0.000078   mdworker    
12:48:19  getattrlist       /Users/mike/1/.DS_Store                                                          0.000006   mdworker    
12:48:19  getattrlist       /Users/mike/1/.DS_Store                                                          0.000003   mdworker    
12:48:19  getattrlist       /Users/mike/1/.DS_Store                                                          0.000004   mdworker    
12:48:19  getattrlist       /Users/mike/1/.DS_Store                                                          0.000003   mdworker    
12:48:19  getattrlist       /Users/mike/1                                                                    0.000024   mds         
12:48:20  lstat64           /Users/mike/1                                                                    0.000028   fseventsd   
^C

You see I typed control-C to exit the tool since fs_usage will wait forever, dumping the usage of all files until you tell it to quit.

Once you've set the trap, just wait for the screen to show the entries similar to mine where I used the touch command to create the file ~/1

share|improve this answer
    
Thank you. Is there a way to write this to a log without having Terminal open? Because I don't know when the file will get recreated, and very likely by then I will forget to have Terminal running. Also, I started fs_usage and then opened a folder in the finder to navigate to my userfolder to delete the file, all of which created more than 400 lines in Terminal, all with stat64, getattrlist or open, all with "Finder" given as the executing application. Quite a few of those lines (about one fourth) give the path "/Users/username/1>>>>". –  what Sep 6 '12 at 18:25
    
Be sure to delete the file before running the fs_usage command. You could redirect the contents of the command to a file by adding `> /tmp/file.out' or whatever, but just minimize the window. The first entry will tell you who creates the file as you scroll back. If you are flooded with answers - just look at what process is using the file and be done with it, no? –  bmike Sep 6 '12 at 18:27
    
When I open a file in Xcode, sometimes Terminal writes "21:36:32 getattrlist /Users/username/1 0.000014 Xcode" for a few lines. It does not happen every time, though. –  what Sep 6 '12 at 20:15
    
I no longer have OS 10.6.8, and I never managed to catch the creation of the file, because I forgot or was too lazy to start up fs_usage, but I accept this as the right answer, because it seems that it should have worked with a more diligent user than me :-) –  what Mar 8 '13 at 11:07
add comment

It looks like the output from an AppleScript dialog. For some reason, the return value got echoed to that file.

In any case, it's probably safe to delete if you don't want it laying around.

share|improve this answer
    
If I delete it, it reappears after some time. I don't run any AppleScripts, at least not knowingly. –  what Sep 6 '12 at 17:40
    
@what bmike's answer is better than mine. Try what he recommends and, if it helps, accept it. –  CajunLuke Sep 6 '12 at 18:05
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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