13

Vista allows files with empty "first name" (for example, ".svn"). However, when I try to remove the filename of an existing file, leaving the prefix, in Explorer or using cmd's 'rename', I fail. How can I easily rename files to include the suffix only?

(I use Vista, if that matters).

0

5 Answers 5

29

You can also do a file name that starts with a period, and has no extension. Try naming it ".whatever." (note the trailing period). This works in both Explorer and from the command line.

4
  • 1
    Usually Explorer insists that "You must type a file name".
    – user1686
    Jun 9, 2009 at 16:52
  • Not if you add the suffix .
    – ripper234
    Jun 10, 2009 at 13:14
  • 1
    Wow! Cool trick. However... it doesn't make ANY SENSE that putting a dot at the end will both allow a "nameless" file and erase the ending dot. That makes me think that this is a BUG in explorer, and is a behavior that could possibly change in the future. It does work though, and this is a common problem with Unix tools that are ported to windows (Msys and Cygwin use dot-folders a lot, in addition to SVN and Git, as mentioned). So, should we be spreading this trick around, if it's likely to stop working?
    – Jerph
    Dec 23, 2009 at 16:38
  • 1
    This is one of the weirdest Windows workaraounds I have encountered in years.
    – ojdo
    Jan 19, 2017 at 9:09
2

rename filename.txt ".txt"

1

If you're looking at something called ".svn" more than likely you're really looking at a folder in which case "del" won't cut it. ".svn" is what TortoiseSVN (and maybe other SVN clients as well) calls its internal folders. There is an option to use an underscore character instead of a period. The "rename" command should still work fine on folders, though.

Other than that, standard cmd.exe commands should work just fine on "extension only" files.

del .abc
ren file.abc .abc
copy file.abc .abc
0

Same issue on Windows Server 2008.
Had a filed named 'keystore', needed it to be named '.keystore' .

  1. Rename file to '.keystore.txt' , the problem is this is not a text file and the '.txt' extension causes file not found problems.

  2. Open command prompt and use the move command to rename the file.

    move .keystore.txt .keystore

Now the file does not have the .txt extension and file type is recongized as KEYSTORE File.

0

From the command line:

>.foo echo #first line
notepad .foo

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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