Auto remove special characters from file names in Linux

Post here if you need help using Actiona
Post Reply
dawid.mlyn
Posts: 1
Joined: 15 Jul 2014, 09:02

Auto remove special characters from file names in Linux

Post by dawid.mlyn »

Hello,

I wonder if I can do something like here: http://superuser.com/questions/399464/f ... ring-savin using actionaz, i.e. do an action on selected text and invoke it via keyboard shortcut.

If it's not possible yet, it would be enouth to read text from clipboard, execute a command on it and write it back to clipboard. Sample command to execute could be:

# F is original file name, newF is new file name
newF=$(echo "$F" | perl -ane 'foreach $wrd(@F){print ucfirst($wrd)." ";}' | sed 's|[^a-zA-Z0-9_.-]||g')

Could you advise how to achieve it?

Regards,
- Dawid
User avatar
Jmgr
Admin
Posts: 1649
Joined: 07 Dec 2005, 15:45
Contact:

Re: Auto remove special characters from file names in Linux

Post by Jmgr »

Hi,

Sorry for the late reply, I was in holidays and this part of the forum is sadly not answered a lot when I'm not available.
I wonder if I can do something like here: http://superuser.com/questions/399464/f ... ring-savin using actionaz, i.e. do an action on selected text and invoke it via keyboard shortcut.
For the text processing you could use the "code mode" (red triangle) and use some Javascript to do what you want. Invoking using a keyboard shortcut is only possible using the "start script" global shortcut (default is Ctrl+Alt+Q). It is currently not possible to setup a specific shortcut for a script.
If it's not possible yet, it would be enouth to read text from clipboard, execute a command on it and write it back to clipboard. Sample command to execute could be:

# F is original file name, newF is new file name
newF=$(echo "$F" | perl -ane 'foreach $wrd(@F){print ucfirst($wrd)." ";}' | sed 's|[^a-zA-Z0-9_.-]||g')
There are some functions to interact with the clipboard: http://wiki.actionaz.org/doku.php?id=en ... :clipboard
To execute a command you could use the Process object: http://wiki.actionaz.org/doku.php?id=en ... em:process
All of this can be used within a Code action or by activating the code mode in any parameter.
"My software never has bugs. It just develops random features."
Post Reply