#Bash help requested

Want to talk about something that isn't covered by another category?

Moderators: Klaus, FourthWorld, heatherlaine, robinmiller, kevinmiller

Post Reply
jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 285
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

#Bash help requested

Post by jameshale » Sun Nov 11, 2018 3:42 am

I am hoping some Bash gurus out there could offer a hand.

I would like bash scripts to do the following tasks.

Note, the input to all these commands will be either 1 or more directory items (files or folders) and so I am assuming we will use "$@" as the input given I do not know in advance what the input will be or how many items we will have.

items 1 and 1a are placing things on the clipboard.
items 2 to 6 are renaming the item(s)

1. place the file name(s) (not the full path) in the clipboard
and
1a. place the file name(s) without extension (not the full path) in the clipboard

2. rename by remove all periods "." from a file/folder name(s) (just the name, not the extension)

3. rename by remove all periods "." from a folder name(s) and place parentheses around the first run of 4 digits
The.Old.Boys.2015.other.text.ext --> The Old Boys (2015) other text.ext

4. rename by replace all underscores "_" in a file name(s) with periods "." (just the name, not the extension)

5. rename by the following transformation on a folder name(s).
"The Old Boys (2015) other text.ext" --> "Old Boys, The (2015) other text.ext"

6.rename by capitalizing a file/folder name(s).
the.old.boys.2015.other.text.ext --> The.Old.Boys.2015.Other.Text.ext

Thank you in advance.

James

bogs
Posts: 2378
Joined: Sat Feb 25, 2017 10:45 pm

Re: #Bash help requested

Post by bogs » Sun Nov 11, 2018 12:32 pm

No answer for the question unfortunately, but curious as to why you would do this through bash scripting instead of through Lc itself, where it would seem to be a (fairly) minor thought process? Just curious, wish I did have an answer for you :oops:
Image

jameshale
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 285
Joined: Thu Sep 04, 2008 6:23 am
Location: Melbourne Australia

Re: #Bash help requested

Post by jameshale » Sun Nov 11, 2018 2:03 pm

I have a finder extension that will run them.
I currently use automator apps (as services) or applets from another app, but Mojave is getting in the way a bit.
To someone who knows bash they would take less time than it took me to write the post whereas for me it would take hours.

bogs
Posts: 2378
Joined: Sat Feb 25, 2017 10:45 pm

Re: #Bash help requested

Post by bogs » Sun Nov 11, 2018 3:09 pm

Gotcha, sorry I have nothing to point you in the right direction :(
Image

Post Reply

Return to “Off-Topic”