0

I have a lot of .odt documents, and I browse them every day. In fact browsing and editing my documents is what I spend most of my time on.

The problem I have is that with the .odt extension visible, all my documents look messy and it's hard to quickly find the right document at a glance.

Here is a comparison:

enter image description here enter image description here

Documents without extension are much easier to look at and identify.

I could search for the document I'm trying to find but most of the time I don't know which document I'm looking for in the first place. Let's say I know there was some document I created 5 days ago, but I don't remember what it was called, and since I have around 2000 documents on my drive It's much easier to just skim through the latest documents and find the right one.

As a result I'd love to be able to hide the extension.

One solution that I'm already aware of is a bash script that removes all extensions from selected files. But when I do that, some programs have trouble finding the .odt files e.g. Loook searches the contents of .odt files but when the extension isn't present it omits the files. There are also some other issues with dropbox and other programs when the extension is missing. Hence, I'm looking for another solution.

I would be prepared to write an extension for nautilus or even change the source code but I'd love to know if there is an easier way of achieving this effect.

In theory this could be done by implementing a simple if statement into the file manager source code, either directly or as an extension of sorts.

if fileName ends in .odt
    don't display the last 4 characters
endif

But I don't know enough about file managers to know how or where to implement this in nautilus. So I'd like to hear if there are other solutions. Although, I would be prepared to learn more about nautilus to implement this somehow if there is no other way.

Rtsne42
  • 1,207

3 Answers3

0

In Linux, everything is a file name. Even the extensions are part of the file name. Linux doesn't need a file extension to recognize file.

Since everything is part of the file name, there is no way to separate between name and extension. You cannot simply hide the seemingly extension part of the name. The easiest way to hide the .odt extension is removing it from file name altogether.

Anwar
  • 76,649
  • 3
    I've seen this answer a couple of times but I find it somewhat misleading. Linux itself might not deal with extensions the same way that windows does but if you try removing the extension you will run into many problems because most programs use extensions. Search might not work, editors might not open the file properly, dropbox will not recognise the file, sharing file with non-linux users will be a pain etc... Also, I don't believe that there isn't a way to write a file manager in a way so that it can ignore a certain part of the file name and not display it. – Rtsne42 Oct 13 '16 at 05:41
  • 1
    @dcweaver01 Editors will open the file as long as that format is correct. some programs depends only on extensions, but in Linux that is a wrong thing to do and You should file a bug-report against that application – Anwar Oct 13 '16 at 05:45
0

Ultimately I solved the problem somewhat indirectly.

I removed all of the .odt extensions from my files with this script:

#!/bin/bash

for file in *.odt
do
 mv "$file" "${file%.odt}"
done

And then instead of using Loook to search the contents, which only works with .odt extensions. I used a program called Recoll which is much more powerful and searches everything regardless of the extension.

Rtsne42
  • 1,207
0

First, Im not buying the initial premise that the filename without the extension is 'much easier to look at and identify' especially since you said that most of the time you don't know the name. I suggest for the use case you put forward that it would be much easier to find the file if you use a list view and sort by clicking on the date header.

However I can offer a solution that will satisfy both the OP (user who just wants it done) and the earlier respondents (purist programmers). A file manager plug in that allows the user to create on-the-fly attributes and displays them in the file manager. so you just define your attribute as name less any .odt extension and look at that in your list view or choose it as a label for your thumbnail view.

This plug-in would also solve another problem which is the opposite to the OPs I want to be able to sort my list view by file extension. The file type column doesnt work because it turns out that there are a lot of different extensions that are all lumped in as image, likewise for document. I have failed to find in the linux world any way of sorting my .mp3s from my .wmas (say) other than search - which I have also found to be problematical.

flurbius
  • 216
  • 1
  • 2
  • 10