Xfce Forum

Sub domains
 

You are not logged in.

#1 2015-02-07 21:34:02

sonycdr
Member
Registered: 2009-01-30
Posts: 130

[Thunar - Custom Actions] Create folder in the current directory...

Create folder in the current directory and Move or Copy on it.

someone in IRC #xfce called <js82> asked a custom action to do this, but they left before. So if they walk arround here...

<js82> anyone able to help with creating a custom action in thunar? I want to be able to do similar to this, using zenity to pop up a dialog window where i enter the name of the folder - http://osxdaily.com/2011/08/07/create-a … os-x-lion/
<pauled> js82: look here, one with zenity "copy and move"
<pauled> js82: http://pclosmag.com/html/Issues/201308/page02.html
<pauled> js82: "Copy To and Move To"
<js82> pauled: thanks but not exactly what i'm looking for, and i'm useless with creating custom actions myself
<pauled> js82: then I don't understand what you are looking for
<pauled> js82: have you tested the custom action I gave you?
<pauled> js82: mv %F $(zenity --file-selection --directory)
<js82> pauled: i would like to be able to select mutliple files and select a custom action that will pop up a zenity window asking me for the name of a directory that i want to create, then all selected files will automatically be moved into this newly created directory. I don't want to move them to an existing directory, i want to create one and move them to it in one go
<pauled> js82: this is what this do
<pauled> js82: please try it
<pauled> js82: create the custom action then try it with test file
<pauled> js82: go to the folder you want to copy/move items
<pauled> js82: then press ctrl + left click on the items you want to move
<js82> pauled: it comes close but it's not exactly what i want. I want the new directory to always be in the same directory as the selected files, so instead of a file browser popping up, i just want an entry dialog popping up asking me for the name of the new directory
<pauled> js82: then ctrl + right click on the items and click "Move To", then pop up dialog box will let you choose the folder, you can also create one
<pauled> js82: I don't see what is wrong with this custom action
<js82> pauled: it does a similar thing but there are more steps. I use this one myself but sometimes i just want to create the new directory in the same one as the selected files., instead of navigating to that folder, clicking on create new and naming it.
<pauled> js82: sorry I don't know, maybe you can try #bash or perhaps there is #zenity
<js82> pauled: no worries, thanks
<pauled> also "man zenity" can give hint
<js82> pauled: i checked zenity --help. there's much more in man. this might be helpful. thanks
* js82 (****0@gateway/web/freenode/ip.*********) left

Name: Move To
Description: Create folder in the current directory and Move on it.
Command: variable=$(zenity --entry --title="Create folder" --text="Name of the folder"); mkdir -p "$variable"; mv -n %F -t "$variable";
File pattern: *
Appears if selection contains: any

Name: Copy To
Description: Create folder in the current directory and Copy on it.
Command: variable=$(zenity --entry --title="Create folder" --text="Name of the folder"); mkdir -p "$variable"; cp -r -n %F -t "$variable";
File pattern: *
Appears if selection contains: any

you can put it directly into ~/.config/Thunar/uca.xml just after <?xml encoding="UTF-8" version="1.0"?><actions>

<action>
	<icon>folder-move</icon>
	<name>Move To</name>
	<command>variable=$(zenity --entry --title=&quot;Create folder&quot; --text=&quot;Name of the folder&quot;); mkdir -p &quot;$variable&quot;; mv -n %F -t &quot;$variable&quot;; </command>
	<description>Create folder in the current directory and Move on it.</description>
	<patterns>*</patterns>
	<directories/>
	<audio-files/>
	<image-files/>
	<other-files/>
	<text-files/>
	<video-files/>
</action>
<action>
	<icon>folder-move</icon>
	<name>Copy To</name>
	<command>variable=$(zenity --entry --title=&quot;Create folder&quot; --text=&quot;Name of the folder&quot;); mkdir -p &quot;$variable&quot;; cp -r -n %F -t &quot;$variable&quot;;</command>
	<description>Create folder in the current directory and Copy on it.</description>
	<patterns>*</patterns>
	<directories/>
	<audio-files/>
	<image-files/>
	<other-files/>
	<text-files/>
	<video-files/>
</action>

Feel free to improve it

Offline

#2 2015-02-08 11:30:50

parnote
Member
From: Independence, MO, USA
Registered: 2010-05-07
Posts: 13

Re: [Thunar - Custom Actions] Create folder in the current directory...

Looks exactly like I would have done! Good job!

Offline

#3 2015-02-08 19:43:28

sonycdr
Member
Registered: 2009-01-30
Posts: 130

Re: [Thunar - Custom Actions] Create folder in the current directory...

There may be a minor bug if the field is empty when creating a folder.

Offline

#4 2015-02-15 13:53:09

alcornoqui
Member
Registered: 2014-07-28
Posts: 832

Re: [Thunar - Custom Actions] Create folder in the current directory...

Thank you, very useful. FWIW, it works with YAD just as with Zenity.

Offline

#5 2015-04-14 13:15:43

SwitchPT
Member
Registered: 2015-04-14
Posts: 1

Re: [Thunar - Custom Actions] Create folder in the current directory...

thansks for the 1 hour of my life that I save trying create this big_smile :clap:

Offline

Board footer

Powered by FluxBB