Ignore contents of compressed file when renaming

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

Ignore contents of compressed file when renaming

Postby Spartan304 » Fri Oct 04, 2019 12:12 am

So I have a program I'm using to compress some .iso files to .gz however when the file is compressed it's naming the file "example1.iso.gz" with a file called "example1.iso" inside. So I am using BRU to remove .iso from the filename however it's also removing it from the file within the g-zipped archive leaving me with a file simply called "example1" and no extension. I've poked around a bit and saw in previous versions of BRU there was an option to ignore file extensions which I believe would fix this however I can't seem to find that option or anything similar to it in the latest version I have installed. Any help would be much appreciated!
Spartan304
 
Posts: 2
Joined: Fri Oct 04, 2019 12:06 am

Re: Ignore contents of compressed file when renaming

Postby Admin » Fri Oct 04, 2019 2:12 am

Hello, in the latest version that option is called:

File/Folder Extensions > Rename File Extensions as Being Part of the File Name

With this option selected, the file name extensions will be ignored and your renaming operations will always affect the entire file name. Use this option with great care, as Windows relies on the file name extension to decide what to do with a file.

The option is in the Renaming Options menu.
Admin
Site Admin
 
Posts: 2344
Joined: Tue Mar 08, 2005 8:39 pm

Re: Ignore contents of compressed file when renaming

Postby Spartan304 » Fri Oct 04, 2019 3:21 am

I saw that option and tried it however it still performed the same way. It removed the .iso from the file name of the .gz archive but it also still removed it from the actual .iso file within the archive.
Spartan304
 
Posts: 2
Joined: Fri Oct 04, 2019 12:06 am

Re: Ignore contents of compressed file when renaming

Postby therube » Fri Oct 04, 2019 5:55 pm

but it also still removed it from the actual .iso file within the archive

That cannot be.
BRU cannot change the filename within the .gz

If the name within the .gz is changing, it is happening outside of BRU, or at least prior to BRU.

Code: Select all
C:\TMP\SEA\>gzip  -v  example1.iso
example1.iso:    84.3% -- replaced with example1.iso.gz

C:\TMP\SEA\>gzip  -l  example1.iso
         compressed        uncompressed  ratio uncompressed_name
               1637               10240  84.3% example1.iso

C:\TMP\SEA\>gzip  -dv example1.iso
example1.iso.gz:         84.3% -- replaced with example1.iso

C:\TMP\SEA\>gzip  -V
gzip 1.3.12


Oh, I see what is happening...

When gzip decompresses the the file, all it does in naming the output, is to drop the .gz extension.

It does not name the file based upon the name of the file as it was originally written & stored within the .gz.


So if you have
example1.iso
You gzip it
example1.iso.gz
You decompress it, gives you
example1.iso

If you have
example1.iso
You gzip it
example1.iso.gz
You RENAME it
testing123.gz
You decompress it, gives you
testing123 - NOT example* anything


All gzip does is to drop the .gz part.
It does not, by default, look at the name as internally written in the .gz (which is in fact, example1.iso).


But...
Code: Select all
  -N, --name        save or restore the original name and time stamp

Code: Select all
gzip  -dNv  testing123.gz
> testing123.gz:   84.3% -- replaced with example1.iso


So it is a matter of using the switches to get the end results you are expecting.
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm


Return to BRU Support