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).

voretaq7
  • 79,345
  • 17
  • 128
  • 213
ripper234
  • 5,710
  • 9
  • 40
  • 49

5 Answers5

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.

Chris Marisic
  • 1,404
  • 8
  • 33
  • 51
Joe Doyle
  • 1,681
  • 14
  • 15
  • 1
    Usually Explorer insists that "You must type a file name". – user1686 Jun 09 '09 at 16:52
  • Not if you add the suffix . – ripper234 Jun 10 '09 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 '09 at 16:38
  • 1
    This is one of the weirdest Windows workaraounds I have encountered in years. – ojdo Jan 19 '17 at 09:09
2

rename filename.txt ".txt"

Kevin Kuphal
  • 9,064
  • 1
  • 34
  • 41
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
squillman
  • 37,618
  • 10
  • 90
  • 145
0

From the command line:

>.foo echo #first line
notepad .foo
John Gietzen
  • 448
  • 5
  • 11
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.

Mark
  • 754
  • 1
  • 7
  • 12