Xfce Forum

Sub domains
 

You are not logged in.

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

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

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.

Offline

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

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

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

Offline

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

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

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

Offline

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

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

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"

Offline

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

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

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

Thanks a lot. Worked perfectly. :-)

Offline

Board footer

Powered by FluxBB