Find out in which subfolder a given file resides
Find out in which subfolder a given file resides
- Subject: Find out in which subfolder a given file resides
- From: Bert Groeneveld <email@hidden>
- Date: Tue, 13 Oct 2015 21:11:35 +0200
Hi, here I am again,
I am working on a script that tells InDesign CS6 (on OS 10.10.5) to auto-layout folder pages. I’m almost ready with the script, except for the part where I need to place images from a folder called “Highres_Images”. This folder contains many subfolders and is on a mounted server volume. At some given moment when the script runs I have a variable that contains just the name of a certain image, for example: set myImage to “picture123.jpg”. To be able to place this image on an InDesign page I need the full HFS path of the image.
The image “picture123.jpg” is somewhere inside the “Highres_Images" folder. This folder contains many, many subfolders, which contain subfolders, etc, etc, several levels deep. I don’t know in which subfolder the image is.
I was thinking of 2 approaches, still need to find out which one works best:
1. I could get a list of all subfolders (HFS paths, not just names) and then loop through the list and find out in which folder the image is (with a Finder statement if exists). If the file exist I know its path and I can exit the loop.
2. I could get a string of all files (HFS paths, not just names) that are inside the Highres_Images folder. Then I could use the filename as a text delimiter and split the string in parts, etc, etc, to find out in which subfolder the file is.
I‘m afraid I really need some “do shell script” stuff to fix this quickly (fast execution time I mean). Unfortunately I have little or no knowledge about this, so I hope someone can help. For example a "do shell script" on how to build a text string with HFS paths of all images inside the Highres_Images folder, including files that are in subfolders.
ps. I’m absolutely sure there are only jpg and some psd files inside the folder, so there shuldn’t be a problem with invisible files, packages, etc.
Thanks in advance for any help,
Bert.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden