How Should Everything Handle file with a final dot or period

General discussion related to "Everything".
Post Reply
therube
Posts: 2364
Joined: Thu Sep 03, 2009 6:48 pm

How Should Everything Handle file with a final dot or period

Post by therube » Sat Sep 22, 2018 12:53 pm

How Should, or Should Everything Handle file names with a final dot or period?

BRU: Renaming file with final dot or period


As it is, Everything has no problem finding them.

Code: Select all

regex:^.*\.$
But after that... delete, copy, move, rename, inline-rename... all fail.

Hmm... I did not try UNC paths here... nope, that didn't work either.

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: How Should Everything Handle file with a final dot or period

Post by NotNull » Sat Sep 22, 2018 1:39 pm

Interesting!

There is a difference between the filesystem, the shell and the filemanager (and programs like Everything)
Support for non-DOS naming isn't available everywhere.

I do this to handle files like that (other than giving them a 'normal' name):

Code: Select all

copy "\\?\C:\temp\period." "\\?\C:\test\period."
(that is using the win32 namespace)

EDIT:That is basically what was in the link you posted. Maybe I should have read that first .... :)


Will test if I can make Everything handle those filenames, but I doubt it ..

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: How Should Everything Handle file with a final dot or period

Post by NotNull » Sat Sep 22, 2018 3:49 pm

NotNull wrote:Will test if I can make Everything handle those filenames, but I doubt it ..
Nope, didn't succeed ... but didnt try very long as there is a workaround: a script (as I solve almost everything with a script ;)


EDIT: CMD has only very limited support for these files. The rename command doesn't at all; move halfway, so only thing left wac a copy + delete action.
Better alternatives:
- Powershell : supports most case (script on demand)
- Cygwin's mv (move) command. Makes sense, as it is not based on a Windows API (MSVCRT.dll), but on POSIX. And that's almost native to the filesystem where these files came from (I think)

  • In Everything, search for:
    endwith:.
  • export that list as a text file to an empty folder. Name it period.txt
  • Put CMD script in the same folder
  • Run script


At the end all "filename." files should be renamed to "filename.___"

HTH ...

Code: Select all

@echo off
setlocal
pushd "%~dp0"

	for /f "delims=" %%x in (period.txt) do call :AXI "%%x"

goto :eof

::============================================
:AXI
::============================================
	set THISFILE=%~1
	copy "\\?\%THISFILE%" "\\?\%THISFILE%___"
	if exist "\\?\%THISFILE%___" del "\\?\%THISFILE%"
goto :EOF

void
Site Admin
Posts: 4972
Joined: Fri Oct 16, 2009 11:31 pm

Re: How Should Everything Handle file with a final dot or period

Post by void » Wed Sep 26, 2018 12:40 am

I've added the \\?\ prefix to filenames ending with . or space for the next version of Everything.

This will allow you to rename from files ending with a . or space in Everything. It will also allow you rename to files ending with a . or space in Everything (which is not supported by the OS).

From the MSDN:

Naming Conventions

The following rules enable applications to create and process valid names for files and directories regardless of the file system:
  • Use a period (.) to separate the base file name from the extension in a directory name or file name.
  • Backslashes (\) are used to separate components in paths, which divides the file name from the path to it, or one directory from one another in a path. You cannot use backslashes in file or directory names. However, they can be required as part of volume names, for example, "C:\". UNC names must adhere to the following format: \\<server>\<share>.
  • Use any character in the current code page for a name, except characters in the range of 0 through 31, or any character that the file system does not allow. A name can contain characters in the extended character set (128–255). However, it cannot contain the following reserved characters:
    < > : " / \ |
  • The following reserved device names cannot be used as the name of a file: CON, PRN, AUX, NUL, COM1, COM2, COM3, COM4, COM5, COM6, COM7, COM8, COM9, LPT1, LPT2, LPT3, LPT4, LPT5, LPT6, LPT7, LPT8, and LPT9. Also avoid these names followed by an extension, for example, NUL.tx7.
    • Windows NT: CLOCK$ is also a reserved device name.
  • Do not assume case sensitivity. Consider names such as OSCAR, Oscar, and oscar to be the same.
  • Do not end a file or directory name with a trailing space or a period. Although the underlying file system may support such names, the operating system does not.
  • Use a period (.) as a directory component in a path to represent the current directory.
  • Use two consecutive periods (..) as a directory component in a path to represent the parent of the current directory.
Some other notes:
As expected, renaming a file or folder to . or .. does not work: Error ERROR_INVALID_NAME (123): The filename, directory name, or volume label syntax is incorrect.

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: How Should Everything Handle file with a final dot or period

Post by NotNull » Wed Sep 26, 2018 8:32 am

void wrote:I've added the \\?\ prefix to filenames ending with . or space for the next version of Everything.
Including support for very long paths?

void
Site Admin
Posts: 4972
Joined: Fri Oct 16, 2009 11:31 pm

Re: How Should Everything Handle file with a final dot or period

Post by void » Wed Sep 26, 2018 8:44 am

Everything 1.4 should already support very long filenames.

If Everything detects a filename with a length greater than or equal to 260 characters, it will prefix the filename with \\?\

The very long filename limitation still somewhat exists for the shell functions, such as drag drop, copying files to the clipboard and deleting files to the recycle bin.
Windows 10 does have an option to enable very long filenames for the shell:
https://www.howtogeek.com/266621/how-to ... haracters/

Renaming and permanently deleting files in Everything with very long filenames should work.

NotNull
Posts: 1595
Joined: Wed May 24, 2017 9:22 pm

Re: How Should Everything Handle file with a final dot or period

Post by NotNull » Wed Sep 26, 2018 9:12 am

Nice! Thx.

Post Reply