Search and open a folder and file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search and open a folder and file
# 1  
Old 08-04-2017
Search and open a folder and file

here is the path on Macintosh:
Macintosh HD/Users/shawn/Desktop/ATP/ATP14 bon bon/ATP14 bon bon.jpg
  1. I need to find the folder with ATP14 in the name, then open the folder
  2. I need to find the file whose name starts with ATP14 in the folder in 1 above


I had been using this in Applescript but its not working now. Would grep command work?

thanks for any help


set text_returned to "ATP14"
set the_producer_initials to "ATP"

do shell script ls -d '/volumes/Macintosh HD/Users/shawn/Desktop/ATP/'*' ' & the_producer_initials's quoted form & "/" & text_returned's quoted form & "' '*"

Last edited by rbatte1; 08-07-2017 at 08:35 AM.. Reason: Converted textual numbered lists to formatted numbered lists with LIST=1 tags. Added ICODE tags
# 2  
Old 08-04-2017
Code:
ls '/volumes/Macintosh HD/Users/shawn/Desktop'/ATP/ATP14*/ATP14*

Since the expansion is done by the shell, not by ls, you could also use echo, or any other command like printf which outputs its parameters.

If the folder and/or files do not exist, it will return that literal string.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Ubuntu

Open in folder feature

My Ubuntu 16.04 OS has a neat feature. If I search for a specific file when it finds the file I can right-click it and select 'Open in folder'. However, I recently installed 12.04 (yes I know its EOL) and I noticed it doesn't seem to have this feature. Does anyone know if it is possible for me to... (3 Replies)
Discussion started by: Circuits
3 Replies

2. Shell Programming and Scripting

Open a folder

this works, it opens a project folder within a category folder: set y to (do shell script "open '/volumes/Features1/" & the_cat & "/" & UpperCase & " '*") this will not simply open the category folder: set y to (do shell script "open '/volumes/Features1/" & the_cat & "/") any ideas, I am... (0 Replies)
Discussion started by: sbrady
0 Replies

3. Shell Programming and Scripting

Need to build Shell Script to search content of a text file into a folder consist several files

Have to read one file say sourcefile containing several words and having another folder containing several files. Now read the first word of Sourcefile & search it into the folder consisting sevral files, and create another file with result. We hhave to pick the filename of the file in which... (3 Replies)
Discussion started by: mukesh.baranwal
3 Replies

4. Shell Programming and Scripting

Search in folder and subfolders

How can this be done? I mean, I want to search for all *png *jpg *bmp files in my ~/Pictures/ folder....How can I list them? Thank you geeks :) :b: (2 Replies)
Discussion started by: hakermania
2 Replies

5. Shell Programming and Scripting

write shell script to search file in folder

hi .. i have a problem how to search file with date and version number(ms_2.0_dd/mm/yy_24)in folder.Here 24 is version number and compare the this file to other file which is in another folder and if does not match then copy this file to respective folder.Also copy different files in different... (1 Reply)
Discussion started by: shubhig15
1 Replies

6. Shell Programming and Scripting

Search through subfolders and move them into separate folder on the base of file size

Hello guys I am sure that you will help me on this issue as you did earlier::) Scenario : I have a folder named "XYZ". It consist many sub-folders and subfolder contain severals files. there may be abc.dat in each subfolder. Now i want to seperate subfolders on follwing conditions- if abc.dat... (12 Replies)
Discussion started by: infiant
12 Replies

7. Red Hat

GUI help requir Every folder open in new Window..

I am using GUI mode in Linux & face a problem that when ever i double click on any folder it opens in new Window. I want to ask all DP members where is the option to disable this thing.. Means i want when ever i double on folder it should open in the same Window. looking for your help.. (1 Reply)
Discussion started by: salman103
1 Replies

8. Shell Programming and Scripting

File Management: How do I move all JPGS in a folder structure to a single folder?

This is the file structure: DESKTOP/Root of Photo Folders/Folder1qweqwasdfsd/*jpg DESKTOP/Root of Photo Folders/Folder2asdasdasd/*jpg DESKTOP/Root of Photo Folders/Folder3asdadfhgasdf/*jpg DESKTOP/Root of Photo Folders/Folder4qwetwdfsdfg/*jpg DESKTOP/Root of Photo... (4 Replies)
Discussion started by: guptaxpn
4 Replies

9. Shell Programming and Scripting

Search for a File Name in a folder

Hello All, Can you please help me with this request. I have to identify a file (having file name with perticular pattern) with in a range. Example: input file name can be: myfile2007_03 myfile2007_45 myfile2007_198 myfile2007_25 myfile2007_101 my program has to identify... (1 Reply)
Discussion started by: sbasetty
1 Replies

10. Shell Programming and Scripting

Parse the .txt file for folder name and FTP to the corrsponding folder.

Oracle procedure create files on UNIX folder on a regular basis. I need to FTP files onto windows server and place the files, based on their name, in the corresponding folders. File name is as follows: ccyymmddfoldernamefile.txt; Folder Name length could be of any size; however, the prefix and... (3 Replies)
Discussion started by: MeganP
3 Replies
Login or Register to Ask a Question