Duplicate Filenames with New Extension-Suffix

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

Duplicate Filenames with New Extension-Suffix

Postby fatmike » Wed Oct 09, 2013 1:30 pm

I have a lot of .mkv and i would like to duplicate them and change the extension to .msp and add a suffix but not retrieve data just the filenames.
Is this possible?

Example:
filename.mkv(500MB) to filename.mkv_suffix.msp(0KB)
I tried using
Extension> Fixed: .msp
Add> Suffix: .mkv_suffix
New Location> Path> New Folder> Copy not Move
The problem is that the file ends up big. I dont want the data to be copied just the filename. The file should be empty.
Any help?
Thank you
fatmike
 
Posts: 3
Joined: Wed Oct 09, 2013 1:13 pm

Create 0-byte files from OrigFilenames

Postby truth » Wed Oct 09, 2013 4:51 pm

BRU is mostly a file-renamer, its not really much of a filename copier.
While you could right-click the files for ClipboardCopy to get NewFilenames+extension,
you still have the extra steps of pasting/editing something to create your 0-byte files.

An easier way (from the commandline) achieves your desired results:
Forfiles /s /m *.mkv /c "cmd /c echo off>@file_suffix.msp"

The /s recurses all SubDirs, so remove it to only affect .mkv's in CurDir.
If you need this often, it can be integrated as a folder's right-click option.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: Duplicate Filenames with New Extension-Suffix

Postby fatmike » Wed Oct 09, 2013 7:07 pm

Yes that worked. Thank you a lot!
How can i create a right click integration? Is it a registry entry? Any link with instructions?
Thanks
fatmike
 
Posts: 3
Joined: Wed Oct 09, 2013 1:13 pm

Integrating a Folder Right-click Option

Postby truth » Wed Oct 09, 2013 9:49 pm

Easiest way is to copy below 4 lines into a text file, then modify the colored-text to meet your preferences:

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\MakeMSPs]
[HKEY_CLASSES_ROOT\Folder\shell\MakeMSPs\command]
@="Forfiles /p \"%1\" /s /m *.mkv /c \"cmd /c echo off>@file_suffix.msp\""

MakeMSPs is the menu-text to display when you right-click a folder.
(You can always rename the key later if you think of something more descriptive)

Remove /s if you dont need to affect all SubDirs (saves time on *.mkv scanning)
Even without /s, you can affect multiple-Dirs by selecting them before right-clicking.

Once you've customized it, save text as a .reg file, then right-click it & choose merge.
Now you can right-click any folder(s) & choose MakeMSPs to create the 0-byte files.
Last edited by truth on Sat Oct 12, 2013 12:11 am, edited 1 time in total.
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay

Re: Duplicate Filenames with New Extension-Suffix

Postby fatmike » Fri Oct 11, 2013 7:21 pm

A bit off topic but if you like you can answer.
I made a batch file of your example which also renames the files in the folder and i tried this in a registry file:
Code: Select all
[HKEY_CLASSES_ROOT\Folder\shell\MyTool Here]
[HKEY_CLASSES_ROOT\Folder\shell\MyTool Here\command]
@="C:\\MyTool\\mytool.bat\"

The problem is that even when you use the context menu it tries to rename/create the files in the parent directory instead of the right-clicked one.
when i run it from the command line works correctly.
fatmike
 
Posts: 3
Joined: Wed Oct 09, 2013 1:13 pm

Re: Duplicate Filenames with New Extension-Suffix

Postby truth » Sat Oct 12, 2013 1:10 am

So long as the admins dont complain, I dont mind, it's a good way to integrate BRC32 commands.
Note the reg-file example should work fine, unless something was mis-typed??
(now edited with quotes to allow for DirPaths containing spaces)

The .bat fails due to a flaw (aka:feature) in Microsofts regedit.
By default, regedit specs ParDir-of-right-clicked-Dirs as CurDir to any executable it launches!
To set right-clicked Dirs as CurDir, you must spec %1 in both the registry AND your batch.

The .reg-file should be as:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Folder\shell\MyTool Here]
[HKEY_CLASSES_ROOT\Folder\shell\MyTool Here\command]
@="C:\\MyTool\\mytool.bat \"%1\""


You have different options within the batch:
If you have multiple commands for the right-clicked Dirs, just insert CD %1 beforehand.
Otherwise, forfiles needs /p %1 to set the desired path(s)
truth
 
Posts: 221
Joined: Tue Jun 25, 2013 3:39 am
Location: Earth, OrionArm, MilkyWay


Return to BRU Support