Xfce Forum

Sub domains
 

You are not logged in.

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

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

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 22.04

Offline

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

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

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: 115

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 22.04

Offline

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

ToZ
Administrator
From: Canada
Registered: 2011-06-02
Posts: 10,948

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: 115

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

Thanks a lot. Worked perfectly. :-)


Ubuntu-Mate 22.04

Offline

Board footer

Powered by FluxBB