Help with wildcard

CD_numb is AM017

this code:

set the_Firstcom_CD to (do shell script "ls -d '/volumes/audioNAS/Firstcom/Access Music/' ") & CD_numb

gives me this:
"

/volumes/audioNAS/Firstcom/Access Music/AM017

"

the item I am looking for is AM017Q.
I can get the "*" syntax right so it never finder that item in Access Music.

can anyone help. Thanks.

Heya Brady, please use code tags for code, output, or any other kind structured text.

But figure yourself:

check_path="/volumes/audioNAS/Firstcom/Access Music"
if [ -r "$check_path" ] 
then	for item in "$check_path"/*
	do 	case "${item##*/}" in
		AM017Q)	echo yay ; break	;;
		esac
	done
fi

Compared to:

check_path="/volumes/audioNAS/Firstcom/Access Music"
if [ -r "$check_path" ] 
then	for item in "$check_path"/*
	do 	case "${item##*/}" in
		AM017Q)	echo yay ; break	;;
		esac
	done
else	echo "Cant read: $check_path!"
fi

For the future, thank you.
Hope this helps

EDIT:
Explanation:
This will look all files/folders (item) of check_path - if it can read from there at all, and if an entry is found named AM017Q it will print yay and break the loop.

thanks.

I am not a coder, I am and audio post engineer who is writing code to find a file for me so I don't have to click 50 times to find what i am looking or.

I am using Applescript so usually I have to add "do shell script" before the code in my Applescript. Can you confirm.

thanks

---------- Post updated at 11:08 AM ---------- Previous update was at 11:05 AM ----------

if CD_numb starts with "AM" then
	tell application "Finder"
		try
			set the_Firstcom_CD to (do shell script "ls -d '/volumes/audioNAS/Firstcom/Access Music/ & CD_numb & " * "'")
			open POSIX file the_Firstcom_CD as alias
			set bounds of Finder window 1 to {100, 90, 875, 990}
		end try
	end tell
end if

I'm not using Applescript, so i have no experience with that.
But given your previous/initial example, i'd guess so.

Give it a try! :slight_smile:
EDIT:
Scratch that, looks WAY different.

EDIT2:
thre was no indication of the use of applescript , please tell so next time in your inital post.

can't get it to work
huge frustration, its huuuuuuge
headache
migraine
more begging and pleading.

But anyway, the * is working as expected, since you pass the full path to it, it is included in the output string.
If you want only the names of the items within that folder, you'll have to change there, and then use only the asterix * .

At least in theory, as i dont know hot to perform string-subtraction within such an environment.

hth

---------- Post updated at 17:17 ---------- Previous update was at 17:14 ----------

Rather than learning a (somehow) limited language, why not use the reall shell?
Just copy paste the code of mine into a new textfile, open a terminal, change to where you stored that file and type:

bash ./script-name.sh 

Where script-name.sh is obviously the name you stored it as.

You could then (if it worked as expeceted) try to execute that script from within your applescript, maybe that could work?

1 Like

figured it out. Edison tried 10,000 times to make a light bulb. I tried 100 times and finally got it.

set the_Firstcom_CD to (do shell script "ls -d '/volumes/audioNAS/Firstcom/Access Music/'" & CD_numb & "*")

thanks for helping

Sorry for not been as helpfull as intended.