Newbie needs to find file

 
Thread Tools Search this Thread
Operating Systems OS X (Apple) Newbie needs to find file
# 1  
Old 09-14-2015
Newbie needs to find file

I need to find a file using Applescript. Applescript is so slow. Someone on the Apple forums gave me some unix code and it works for the most part. The ls command is really list and not find but when it works, it returns the path to the file instantly, NOT 45 seconds Applescript takes.

here is the path to the folder:
Code:
/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA/

here is the name of the file:
AFRICA1 Faso, Burkina.doc

here is the shell script I am using that does not work:
text_returned is the result of a dialog box, in this example its AFRICA1
Code:
set the_AVSheet to (do shell script "ls '/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA/" & text_returned & "' '*")

can anyone help me get this to work with either ls or a find command. Thank you very much.

I am an audio post engineer who searches a dozen servers for the file I need and write code to help me find the file instead of me clicking 50 times through a folder structure that is brutal. Thanks for any help.

Last edited by vbe; 09-14-2015 at 11:05 AM.. Reason: attempt to put code tags...
# 2  
Old 09-14-2015
to start with:
Code:
find '/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA' -type f -name '*Burkina*'

# 3  
Old 09-14-2015
this is how we work. This is the file name:
AFRICA1 Faso, Burkina.doc

We just refer to the project or file as AFRICA1. The rest of the file name sometimes it too hard to remember or pronounce. So in Applescript I use a dialog box to have the user enter the project code (AFRICA1) and I use that info in searching for the file in the folder. I hope that all makes sense. Maybe if I replace "*Burkina" with the variable text_returned that will work.
# 4  
Old 09-14-2015
replace '*Burkina*' by 'AFRICA1*' in the find command given in post#2
# 5  
Old 09-14-2015
I tried this but Applescript will not compile it.
Code:
set the_AVSheet to (do shell script "find '/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA' -type f -name '*Burkina*'"

---------- Post updated at 10:26 AM ---------- Previous update was at 10:25 AM ----------

this does not work
Code:
find '/volumes/DW/700Club/AVSHEET/WorldReach now CBN International/AFRICA' -type f -name '*AFRICA1*'


Last edited by vbe; 09-14-2015 at 11:57 AM.. Reason: code tags please...
# 6  
Old 09-14-2015
no star in front of A...
# 7  
Old 09-14-2015
I'll fix that but do I need to put do shell script in front of the find command and do I need to put quotes before find and after the last character of the command line. thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Newbie help - parsing through a file

Hello guys, I am a newbie to all of this - I'd like some help with a file I have. It's a ~100mb CSV file with approximately 30 columns. What I'd like to do is to search through the file and REMOVE any lines with a certain case insensitive string in any of the columns: So my file looks... (4 Replies)
Discussion started by: Lokhtar
4 Replies

2. Shell Programming and Scripting

wanted to find both link file and ordinary file using single find command

find . -type fl o/p is only the ordinary file. where in it wont give the link files. (2 Replies)
Discussion started by: nikhil jain
2 Replies

3. Shell Programming and Scripting

Looking for help with parsing file contents in bash [newbie]

Hi I'm just messing around with bash and trying to learn it because I have a course next semester dealing with OS design where we need to know how to use SSH client and either bash or ksh. I've never done shell scripting before. I just started today and I was wondering how parsing files... (1 Reply)
Discussion started by: mehungry
1 Replies

4. Shell Programming and Scripting

Newbie.. Find if a file exists and open, if not create the desired file..

Hey all, I'm brand new to script writing, I'm wanting to make a script that will ask for a file and then retrieve that file if it exists, and if it doesn't exist, create the file with the desired name, and I'm completely stuck.. so far.. #! bin/bash echo "Enter desired file" read "$file" if ... (5 Replies)
Discussion started by: Byrang
5 Replies

5. Shell Programming and Scripting

perl script to print file information - newbie

Hi I have a perl script that prints all the video and audio file information(playing duration). It works fine in one of my friends linux laptop. But it doesn't work in my both windows and linux. My friend told me I have to do install some module ( ppm instal ...... ) but I have no... (1 Reply)
Discussion started by: srijith
1 Replies

6. Shell Programming and Scripting

perl newbie . &&..programming newbie (question 2)

Hello everyone, I am having to do a lot of perl scripting these days and I am learning a lot. I have this problem I want to move files from a folder and all its sub folders to one parent folder, they are all .gz files.. there is folder1\folder2\*.gz and there are about 50 folders... (1 Reply)
Discussion started by: xytiz
1 Replies

7. UNIX for Dummies Questions & Answers

UNIX newbie NEWBIE question!

Hello everyone, Just started UNIX today! In our school we use solaris. I just want to know how do I setup Solaris 10 not the GUI one, the one where you have to type the commands like ECHO, ls, pwd, etc... I have windows xp and I also have vmware. I hope I am not missing anything! :p (4 Replies)
Discussion started by: Hanamachi
4 Replies

8. Shell Programming and Scripting

NEWBIE: If and Find in shell script

Basically I have a shell script and i want to search the computer for a folder and if that folder exists i want to take some action. Not sure exactly how to do this most efficiently. Not very experienced....any help would be appreciated. (1 Reply)
Discussion started by: meskue
1 Replies

9. UNIX for Dummies Questions & Answers

Unix masters please help newbie on "find" command

please help me figure out how to do this I wont lie, this is for a homework problem and I have searched on google for a long time and still can't figure out what to do. here is the problem So there's a folder let's say called "bare" in it, there are 10 dirs with names from "part1" through... (2 Replies)
Discussion started by: white_raven0
2 Replies

10. UNIX for Dummies Questions & Answers

Newbie question about difference between executable file and ordinary file

Hi, I am newbie in unix and just started learning it. I want to know what is the difference between an executable file and a file (say text file). How to create executable file? What is the extension for that? How to differentiate ? How does it get executed? Thanks (1 Reply)
Discussion started by: Balaji
1 Replies
Login or Register to Ask a Question