Home Dashboard Directory Help
Search

Renaming file in shell to anything beginning with a dot (period) causes error by Jake74


Status: 

Active


1
3
Sign in
to vote
Type: Bug
ID: 843717
Opened: 3/30/2014 12:14:03 PM
Access Restriction: Public
1
Workaround(s)
view
1
User(s) can reproduce this bug

Description

OS: Windows 7

Cannot create file whose filename begins with dot (period)

Steps to Repro:
1. Enable file extensions visible in shell via Folder Options;
2. Right click in any folder and select 'New Text Document';
3. Type name ".htaccess" (without quotes).

Expected Result:
A 0-byte text file with the filename ".htaccess" is created.

Actual Result:
Error message "You must type a filename" is displayed, and filename is not accepted.

Comments:
There is genuine reason to create files whose filenames begin with a period, not least that it is a common protocol on web servers and other OSs to indicate a hidden file.
Renaming a file produces the same error, if the name is changed.

Details
Sign in to post a comment.
Posted by Joe Tinney on 4/16/2014 at 7:11 AM
I can't reproduce this issue in PowerShell 3.0. As mentioned below, Windows Explorer Shell is not the same as PowerShell. Example below creating and renaming files to names starting with "."

PS 3.0:
PS > New-Item -Path .\ -Name ".self" -ItemType File


    Directory: C:\Users\test


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         4/16/2014 10:04 AM         0 .self


PS > Rename-Item -Path ".\.self" -NewName ".oldself"
PS > dir .oldself


    Directory: C:\Users\test


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---         4/16/2014 10:04 AM         0 .oldself
Posted by Bill_Stewart on 4/2/2014 at 6:47 PM
This list is for PowerShell bugs. This Windows Explorer behavior is probably by design and has nothing whatsoever to do with PowerShell.
Sign in to post a workaround.
Posted by Joe Tinney on 4/16/2014 at 7:12 AM
You can create and manage these files in Windows PowerShell:

PS > New-Item -Path .\ -Name ".self" -ItemType File
PS > Rename-Item -Path ".\.self" -NewName ".oldself"