Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am working on one PHP project, and I am having some files for that. Some of the files have anextension as

file_name.php~

What does it mean and how do those files get created?

share|improve this question
    
Which editor are you using? ~ is a common postfix for auto-saved files. –  dutt Dec 21 '12 at 14:19
    
Indeed, either an auto-save or a flag to show someone else has the file open (like MSOffice does). –  Brad Christie Dec 21 '12 at 14:19
    
@dutt: i am using notepad++. but with this how such files generates? –  user1794794 Dec 21 '12 at 14:24
    
Notepad++ can also be configured to backup to a custom directory away from your current files. Or you can turn off the backup altogether. –  w3d Dec 21 '12 at 14:30
add comment

migrated from stackoverflow.com Dec 21 '12 at 15:13

This question came from our site for professional and enthusiast programmers.

2 Answers

Those are backup files created by the text editor you are using (or one of the people working on the same project).

share|improve this answer
12  
... and they're very dangerous to have online because they may not be parsed by the PHP interpreter, revealing the source code including any passwords that may be contained therein. –  Pekka 웃 Dec 21 '12 at 14:20
    
And @Pekka is totally right! –  X.L.Ant Dec 21 '12 at 14:21
2  
Yes - although many default web server configurations include rules to forbid access to files beginning or ending in ~, you must not rely on that! Remove them from web-accessible locations immediately. –  Michael Dec 21 '12 at 14:21
    
@X.L.Ant: how that back up generates? are there any steps to create it or automatically editor creates it. and specifically which editor. i am using notepad++ –  user1794794 Dec 21 '12 at 14:22
    
See praveen answer. –  X.L.Ant Dec 21 '12 at 14:24
show 2 more comments

When you are working with files, editing them, the editor(almost all of them) creates a copy of it with names like you provided and does the editing on that file. Upon saving the file the changes are saved to the original files.

These files are generally hidden from the user. You are seeing it probably because the option to show hidden files is turned on.

When you quit from your text editor, that temporary file gets deleted.

Finally, You don't need to worry about the creation of those files :)

NOTE: JUST MAKE SURE YOU DON'T UPLOAD THEM TO THE SERVER WHICH CAN BE A SECURITY ISSUE AS DISCUSSED IN THE COMMENTS :)

share|improve this answer
    
Thanks Praveen.. –  user1794794 Dec 21 '12 at 14:26
    
Welcome :) And don't worry about those files :p –  praveen Dec 21 '12 at 14:27
1  
@praveen: You should worry about those files if you accidentally upload them to your live server (as Pekka points out on the other answer). –  w3d Dec 21 '12 at 14:32
    
Yes! that is a point to worry! I just meant to tell him not to worry about why those files are created. :p –  praveen Dec 21 '12 at 14:33
add comment

Your Answer

 
discard

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