Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-02-26 18:18:33

paul1149
Member
Registered: 2016-02-29
Posts: 22

Thunar custom action: Change file name to Title Case

Hi,

I have a custom action that changes the file name to lower case, and it works great:

for file in %N; do mv "$file" "$(echo "$file" | tr '[:upper:]' '[:lower:]')"; done

Is there something similar for Title, or Proper, Case? I tried the obvious substitutions, but they didn't work.

Thanks.

Last edited by paul1149 (2018-02-26 18:19:21)


MX17 Linux (debian 9.3) x64; Xfce 4.12.3. C2D 2.8ghz; 6GB RAM; SSD

Offline

#2 2018-02-26 19:02:49

ToZ
Moderator
From: Canada
Registered: 2011-06-02
Posts: 4,619

Re: Thunar custom action: Change file name to Title Case

Try this:

for file in %N; do mv "$file" "$(echo "$file" | sed 's/.*/\L&/; s/[a-z]*/\u&/g')"; done

Offline

#3 2018-02-26 20:32:48

paul1149
Member
Registered: 2016-02-29
Posts: 22

Re: Thunar custom action: Change file name to Title Case

Awesome, ToZ. Thank you so much. That really nails it. This will get a lot of use. smile


MX17 Linux (debian 9.3) x64; Xfce 4.12.3. C2D 2.8ghz; 6GB RAM; SSD

Offline

Board footer

Powered by FluxBB