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.

In my working directory,there are many files ending with "~"?
can i prevent win7 from creating that kind of file?

enter image description here

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Form the screenshot you provided, I'm sure files with suffix ~ is produced by gvim.

Vim uses ~ file to make a backup of the file which you edited.

You may refer to Why does Vim save files with a ~ extension? for more details and instructions on how to avoid that.

share|improve this answer
    
I think Emacs creates them also. Though I suppose you're more likely to end up with Vim "inadvertently" on Windows than Emacs. It might be included in Git for windows. –  Brady Trainor Jul 20 at 5:07
    
@BradyTrainor Yes, you are right. Emacs and many other programs also create a ~ file when modifing an existing file. For this particular question, I come to my conclusion from the screenshot provided. You may see the icon of vim before the filename. –  pallxk Jul 21 at 10:00

Windows is not responsible for creating that file. And it is also not responsible for preventing creation of files with legal names.

Appending a ~ to the file name/extension is a common way for many programs to create a backup copy of the original file before saving, just in case you want to undo your changes. This is actually a more common pattern on FOSS/Linux programs, and tends to be carried with them when they are ported to Windows. Deal with whichever editor is creating the files in the first place.

share|improve this answer
    
Not Correct not only Foss/Linux Tools like gvim does it also word/Excel/Powerpoint make such files but thy have a different meaning they stand for the Actual open Document and are automatically removed when the file is closed. –  konqui Jul 11 at 10:57
    
@konqui I meant the ~ to denote temporary files is a common pattern across FOSS programs. That does not mean other programs can't use it, and it also does not mean the pattern cannot mean anything else. MS Office doesn't use tildes anyway; its temporary file naming scheme is different. At no point did I say other programs may not create temporary files. –  Bob Aug 15 at 17:22

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.