Renaming file with final dot or period

Post any Bulk Rename Utility support requirements here. Open to all registered users.

Renaming file with final dot or period

Postby handvprice » Sat Sep 22, 2018 3:36 am

In Win 10, a third-party program created files ending in "." with no extension like "filename.", that can be seen in Explorer or cmd dir, but can't be renamed, deleted or copied. This is an old windows limitation. I need to copy them, so hoped to rename them to either remove the final period (preferable) or else to add an extension (say, "filename.x"). The only alternative I've found is using 7-zip (which for some reason succeeds) on them individually (but there are ~8000 files...). I'm hoping BRU can recursively do it, but my trying so far isn't showing any promise. Is there a way to do this as a find-and-replace, or find-and-chop, or even a regexp? (I'm not very familiar with regexp). TY!
handvprice
 
Posts: 1
Joined: Sat Sep 22, 2018 12:13 am

Re: Renaming file with final dot or period

Postby therube » Sat Sep 22, 2018 1:34 pm

WARNING
WARNING: THE MENTIONED -sdel SWITCH IS POTENTIALLY DANGEROUS
WARNING

(Not that it does anything "wrong", but it my do something that you, the user, were not expecting, so test safely.
Similar in concept to doing a DEL . /S or RD . /S /Q.)



---------



That is a rather interesting conundrum.


I don't think that BRU can handle it - at all.
I can get the files into BRU, but it only sees them (incorrectly) as 0-bytes, & then is unable to manipulate them at that.

My file manager, Altap Salamander, has no problem seeing them, deleting them, or renaming them - individually.

Really no issue in deleting the files, even in bulk.
Simply use the DEL command, or I suppose RD would work too.
One issue might be if you only wanted to delete filename. files but wanted to leave the "filename" (a version without the dot) there.


Now 7-zip is very interesting.

(I don't use the GUI, but command-line...
On my end, I've renamed 7-zip.exe to 777.exe, & I'll use that from here on...)


777 can archive the files.
If the files you're after are in a single (or at least relatively few) directory tree(s), you can archive that tree, including the "dot" files.
777 can also delete files upon archiving, again including the "dot" files.
And most importantly, 777 can extract the files from its' archive, & in doing so, the "dot" files end up being extracted as "_" files.


So...

Code: Select all
Directory of I:\XXX\YYY\X\Y

09/22/2018  08:23 AM    <DIR>          .
09/22/2018  08:23 AM    <DIR>          ..
09/22/2018  07:54 AM               390 0.7z
09/22/2018  07:55 AM               507 0.ARJ
09/22/2018  08:04 AM               535 00.7z
09/22/2018  08:23 AM               572 dotdot.
09/22/2018  08:23 AM               524 dotdotdot.
09/22/2018  08:23 AM    <DIR>          Z
               5 File(s)          2,528 bytes

Directory of I:\XXX\YYY\X\Y\Z

09/22/2018  08:23 AM    <DIR>          .
09/22/2018  08:23 AM    <DIR>          ..
09/22/2018  07:57 AM               390 0.7z
09/22/2018  07:57 AM               507 0.ARJ
09/22/2018  08:23 AM               473 dotdot.
09/22/2018  08:23 AM               473 dotdotdot.
               4 File(s)          1,843 bytes

     Total Files Listed:
               9 File(s)          4,371 bytes

Code: Select all
777  a  ARCHIVE.7z  -sdel

The -sdel switch tells 777 to 'delete files after compression'.
So after compressing the files/directories into ARCHIVE.7z, they are deleted (both the files, & any directories, & including dot files).
At that point, all that is left is ARCHIVE.7z.

Code: Select all
7-Zip 18.01 (x86) : Copyright (c) 1999-2018 Igor Pavlov : 2018-01-28

Scanning the drive for archives:
1 file, 1430 bytes (2 KiB)

Listing archive: ARCHIVE.7z

--
Path = ARCHIVE.7z
Type = 7z
Physical Size = 1430
Headers Size = 278
Method = LZMA2:6k
Solid = +
Blocks = 1

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2018-09-22 08:23:32 D....            0            0  Z
2018-09-22 07:54:55 ....A          390         1152  0.7z
2018-09-22 07:55:57 ....A          507               0.ARJ
2018-09-22 08:04:17 ....A          535               00.7z
2018-09-22 08:23:42 ....A          572               dotdot.
2018-09-22 08:23:39 ....A          524               dotdotdot.
2018-09-22 07:57:40 ....A          390               Z\0.7z
2018-09-22 07:57:40 ....A          507               Z\0.ARJ
2018-09-22 08:23:32 ....A          473               Z\dotdot.
2018-09-22 08:23:30 ....A          473               Z\dotdotdot.
------------------- ----- ------------ ------------  ------------------------
2018-09-22 08:23:42               4371         1152  9 files, 1 folders


Now, all that is left to do, is to extract the files from ARCHIVE.7z.
Code: Select all
777  x  ARCHIVE.7z


Code: Select all
Directory of I:\XXX\YYY\X\Y

09/22/2018  08:33 AM    <DIR>          .
09/22/2018  08:33 AM    <DIR>          ..
09/22/2018  07:54 AM               390 0.7z
09/22/2018  07:55 AM               507 0.ARJ
09/22/2018  08:04 AM               535 00.7z
09/22/2018  08:30 AM             1,430 ARCHIVE.7z
09/22/2018  08:23 AM               524 dotdotdot_
09/22/2018  08:23 AM               572 dotdot_
09/22/2018  08:23 AM    <DIR>          Z
               6 File(s)          3,958 bytes

Directory of I:\XXX\YYY\X\Y\Z

09/22/2018  08:23 AM    <DIR>          .
09/22/2018  08:23 AM    <DIR>          ..
09/22/2018  07:57 AM               390 0.7z
09/22/2018  07:57 AM               507 0.ARJ
09/22/2018  08:23 AM               473 dotdotdot_
09/22/2018  08:23 AM               473 dotdot_
               4 File(s)          1,843 bytes

     Total Files Listed:
              10 File(s)          5,801 bytes

The dot files are extracted, renamed to "_".

(Tell Igor, thank you ;-).)



---------



Heh.
Before this, I never even knew that you could have a "dot" file.
Code: Select all
I:\XXX\YYY\X\Y>dir > \\?\i:\xxx\yyy\x\y\dotdot.
I:\XXX\YYY\X\Y>dir > \\?\i:\xxx\yyy\x\y\dotdotdot.
I:\XXX\YYY\X\Y>dir > \\?\i:\xxx\yyy\x\y\z\dotdot.
I:\XXX\YYY\X\Y>dir > \\?\i:\xxx\yyy\x\y\z\dotdotdot.
therube
 
Posts: 735
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support