I would like to change the default name of newly created files and directories from Thunar  [Solved]

Message
Author
Wirtualny
Posts: 124
Joined: Sat Jun 26, 2021 9:46 am

I would like to change the default name of newly created files and directories from Thunar

#1 Post by Wirtualny »

I would like every new file I create in MX Linux XFCE using the right mouse button to have a default name in the form of a current date in YYYYMMDD format followed by my name instead of the name "New file". Similarly, I would like every new directory I create to have a default name in the form of a date in the format YYYYMMDD followed by my name instead of "New Directory".

For example, every new file or directory created today should have the default name offered by Thunar "20231212 Wirtualny".

Is this achievable?

User avatar
dolphin_oracle
Developer
Posts: 22717
Joined: Sun Dec 16, 2007 12:17 pm

Re: I would like to change the default name of newly created files and directories from Thunar

#2 Post by dolphin_oracle »

You can't change the default thunar action, but you can create a custom right click action for that. You can even give it a shortcut key combo if you like.

the command would be something like

Code: Select all

touch "$(date +%Y%m%d) $USER"
http://www.youtube.com/runwiththedolphin
lenovo ThinkPad X1 Extreme Gen 4 - MX-23
FYI: mx "test" repo is not the same thing as debian testing repo.
Live system help document: https://mxlinux.org/wiki/help-antix-live-usb-system/

User avatar
CharlesV
Administrator
Posts: 8050
Joined: Sun Jul 07, 2019 5:11 pm

Re: I would like to change the default name of newly created files and directories from Thunar  [Solved]

#3 Post by CharlesV »

I have something very similar to that, but I could never get the touch command to work from my custom action.

I created a script ( LogDate.sh ) , and then set a custom action to run that. Then in LogDate.sh I have the following:

Code: Select all

touch "log_$(date +"%Y%m%d_%I%M%p").log"
This allows me to not have to change the action, only the LogDate.sh script and i can add / modify any way I want.

If OP wanted, then a NewFile.sh with the following content should work:

Code: Select all

touch "$(date +"%Y%m%d_%I%M%p Wirtualny")"
( remove the _%I%M%p if you dont want time )

Then, Thunar | Custom Actions
create a new Custom Action and set the NewFile.sh as the command, and Name it something like New File.

Right click on white space in thunar and choose the New File entry approx halfway down the list.
*QSI = Quick System Info from menu (Copy for Forum)
*MXPI = MX Package Installer
*Please check the solved checkbox on the post that solved it.
*Linux -This is the way!

Charlie Brown

Re: I would like to change the default name of newly created files and directories from Thunar

#4 Post by Charlie Brown »

...+

Code: Select all

mkdir "$(date +%Y%m%d) $USER"

Wirtualny
Posts: 124
Joined: Sat Jun 26, 2021 9:46 am

Re: I would like to change the default name of newly created files and directories from Thunar

#5 Post by Wirtualny »

Thank you very much! :)

It's greater than I have expected!

Post Reply

Return to “XFCE Desktop Environment”