Xfce Forum

Sub domains
 

You are not logged in.

#1 2018-02-27 18:22:07

fixit
Member
Registered: 2015-01-19
Posts: 129

Thunar custom action to remove files with append only attribute

I would like to make a Thunar custom action that can remove files with the append only attribute.

I know I would need chattr -a and then a rm command.


Ubuntu-Mate 24.04

Offline

#2 2018-02-27 21:21:46

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Thunar custom action to remove files with append only attribute

Since chattr requires root privileges, you could embed gksudo into your command, like:

for file in %F; do gksudo "chattr -a '"$file"'; rm '"$file"'"; done

Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#3 2018-02-27 21:36:25

fixit
Member
Registered: 2015-01-19
Posts: 129

Re: Thunar custom action to remove files with append only attribute

It did not work.

gksudo box came up ok. Appearance conditions are checked off for text,audio,video,image, and other files.

File attributes are -rw-rw-r--


Ubuntu-Mate 24.04

Offline

#4 2018-02-27 22:38:39

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 11,486

Re: Thunar custom action to remove files with append only attribute

Hrmmm. Try it this way. Create a shell script with the following content:

#!/bin/bash

for file in "$@"
do
        chattr -a "$file"
        rm "$file"
done

...and make it executable.

For the custom action command, set it to "gksudo /path/to/your/script %F"


Please remember to mark your thread [SOLVED] to make it easier for others to find
--- How To Ask For Help | FAQ | Developer Wiki  |  Community | Contribute ---

Offline

#5 2018-02-27 22:50:30

fixit
Member
Registered: 2015-01-19
Posts: 129

Re: Thunar custom action to remove files with append only attribute

Thanks a lot. Worked perfectly. :-)


Ubuntu-Mate 24.04

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.008 seconds, 7 queries executed - Memory usage: 530.11 KiB (Peak: 531.92 KiB) ]