Remove special characters

Dolphin Service Menus

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

1
Score 50.0%
Description:

Rename all files and directories, including sub directories, removing or replacing special characters.
The new name is compatible with MS-DOS FAT16 and URL (RFC 1738)
All characters different from A–Z, 0–9 and $-_!'() are renamed

For exemple :
* Fichier d'écriture *.txt
Will be renamed in :
-_Fichier_d_ecriture_-.txt

You can edit rm_special_char.py to change the new characters.

To install, simply put rm_special_char.py and rm_special_char.desktop in ~/.kde/share/apps/konqueror/servicemenus

Don't hesitate giving feedbacks or improvements.
Last changelog:

12 years ago

1.1 RELEASE
======================================

BUGS FIXES :
001 ==> Include all ASCII characters


1.2 RELEASE
======================================

NEW FEATURES :
001 ==> Choose if you want to rename to lower cases or not

BUGS FIXES :
001 ==> Remove all non ASCII characters
002 ==> Translation table updated for german characters


1.3 RELEASE
======================================

BUGS FIXES :
001 ==> Now it also renames the first directory (the one you make the action on, not only files and sub-directories contained in it)

danux

10 years ago

I tried to run it in KDE 4 and din't work, so I modified the .desktop file to:


[Desktop Entry]
Version=1.3
Type=Service
ServiceTypes=KonqPopupMenu/Plugin,inode/directory
Actions=Remove_special_characters;Remove_special_characters_lower
X-KDE-Submenu=Recursively remove special characters
X-KDE-Submenu[fr]=Supprimer les caractères spéciaux récursivement
X-KDE-Submenu[es]=Remover caracteres especiales

[Desktop Action Remove_special_characters]
Name=keeping UPPER cases
Name[fr]=en gardant les MAJUSCULES
Name[es]=conservando las MAYÚSCULAS
Icon=background
Exec=~/bin/rm_special_char.py %u %n && kdialog --title "Special characters successfully removed" --passivepopup "" 5; echo
Exec[fr]=~/bin/rm_special_char.py %u %n && kdialog --title "Les caractères spéciaux ont été supprimés avec succès" --passivepopup "" 5; echo
Exec[es]=~/bin/rm_special_char.py %u %n && kdialog --title "Se han removido los caracteres especiales, manteniendo las mayúsculas" --passivepopup "" 5; echo

[Desktop Action Remove_special_characters_lower]
Name=renaming in lower cases
Name[fr]=en renommant en minuscules
Name[es]=renombrar y pasar a minúsculas
Icon=background
Exec=~/bin/rm_special_char.py %u %n -lower && kdialog --title "Special characters successfully removed" --passivepopup "" 5; echo
Exec[fr]=~/bin/rm_special_char.py %u %n -lower && kdialog --title "Les caractères spéciaux ont été supprimés avec succès" --passivepopup "" 5; echo
Exec[es]=~/bin/rm_special_char.py %u %n -lower && kdialog --title "Se han removido los caracteres especiales, cambiando todo a minúsculas" --passivepopup "" 5; echo



By the way I also added Spanish translation.


¡¡Atention KDE4 users!!

You have to put your .desktop file to: ~/.kde4/share/kde4/services/ServiceMenus

You have to put the .py file to:
~/bin (local bin folder)
or specify the correct location in the path of the .desktop file.

If you have some path problems (like me) you can try to change ~/ to /home/yourname/

Hope this helps someone.

Report

cewanf

12 years ago

Thanks for great addition to Konqueror!

Would it be possible to have this menu for single files as well, and not just directories?

BR

Report

app3al

12 years ago

Nice idea you had!

Report

poliicallycorrect

12 years ago

Would be better if apps accept special characters !!!! (and no need of this app...)

Report

C

Topazz

12 years ago

Sure, but when you went to upload files on the internet, give files to a friend that hasn't got linux (or import files from a fat32 or NTFS drive), read music or pictures files elsewhere than on a computer, ... it's quite safe removing theses characters, specially because computers are designed for english language...

Report

daphreak

12 years ago

This is one of the little scripts that makes life easier ! Thanks !

Report

panzi

12 years ago

nice.

Is it checking for collisions? And I would suggest to convert characters like é to e and ä to ae etc. ;)
And what about lower/upper case? FAT ignores the case but linux filesystems don't (cp /extfs/foo /extfs/FOO /fat will raise a error).

Report

whiskybar

12 years ago

I don't know but maybe you can transform the accented characters to their unaccented the way unac does it:

http://www.nongnu.org/unac/

Report

C

Topazz

12 years ago

> Is it checking for collisions ?
Yes, if a file become the same name as an other one, it ads as many "-" characters it needs at the beginning of the name.
(Since today 20H40, before it was at the end)

> I would suggest to convert characters like é to e and ä to ae
Look at the translation code in rm_special_char.py
You will see that é becomes e as you say, but ä becomes a.
If you think it's better to rename ä to ae, I can modify the source code, but in that case post me a list of all the characters you think it's better to change (looking in rm_special_char.py)

> And what about lower/upper case?
I though at this problem, and for the moment upper case aren't renamed in lower case.
But you're right, I will change that.
In the next version all upper cases will be rename in lower cases.
Check for version 1.2 tomorrow.

Thanks for your suggestions, Topazz.

Report

panzi

12 years ago

If it's not possible to write an umlaut, it is common to use this translation:

ä -> ae
Ä -> Ae
ü -> ue
Ü -> Ue
ö -> oe
Ö -> Oe
ß -> ss or sz or just s ("sharp s")

These letters are uses in german.

Report

C

Topazz

12 years ago

Thanks, I will change that also.

Would you have the german translation of :
Recursively remove special characters
and :
Recursively create M3U playlists
?

Thanks in advance

Report

C

Topazz

12 years ago

Version 1.2 is now online.
For this version, I would need also the german translation of :
keeping UPPER cases
renaming in lower cases

Thanks

Report

quax

12 years ago

Recursively remove special characters
[de]=Sonderzeichen rekursiv entfernen

"Special characters successfully removed for \"%n\""
[de]="Sonderzeichen von \"%n\"erfolgreich entfernt"

keeping UPPER cases
[de]=Grossbuchstaben erhalten


renaming in lower cases
[de]=In Kleinbuchstaben umwandeln


Report

12 years ago

1.1 RELEASE
======================================

BUGS FIXES :
001 ==> Include all ASCII characters


1.2 RELEASE
======================================

NEW FEATURES :
001 ==> Choose if you want to rename to lower cases or not

BUGS FIXES :
001 ==> Remove all non ASCII characters
002 ==> Translation table updated for german characters


1.3 RELEASE
======================================

BUGS FIXES :
001 ==> Now it also renames the first directory (the one you make the action on, not only files and sub-directories contained in it)

12345678910
product-maker Count: 4 Rating: 5.0
File (click to download) Version Description Downloads Date Filesize DL OCS-Install
Pling
*Needs ocs-url or ocs-store to install things
Details
license
version
1.3
updated May 09 2007
added Mar 10 2007
downloads today
0
page views today 1
System Tags addon