Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 7814 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

I'm wondering if anyone has a script or an AppleScript that would allow me to import the name of every file in a set of folders into the database. I need to get the folder name and the file name within the folder.

Any suggestions are appreciatied. Thanks.

Posted

Thanks. I was looking at this plugin and given my limited knowledge of this, how is it possible to have the plugin read in the file names one to a record? I noticed that in the example all the file names are read into a global field. I need to have each file in a separate record along with the folder name. Any clarification is appreciated.

Posted

The nature of all plugins is to deal with 1 field at a time because of the way FM designed the plugin interface. You'll need a simple script to parse the filenames and put them in their own records after the call to the Troi file plugin.

Posted

I agree that a plug-in is the way to go if you need this function as part of a solution that you will be distributing. But if you just need a one-off AppleScript to get initial values into your database, here's an adapted version of the Picture Import Applescript that comes with FileMaker:

--choose a folder with picture files

activate

set folderPath to (choose folder with prompt "Choose a folder with filenames to import

Posted

Thanks! It works great.

One additional thing I am trying to figure out is how to set the Folder Name field in the database to the name of the folder that the file came from.

Ultimately the path created in a calculation will create a link to the FTP directory, but for this to work, I have to be able to get the folder name for the path string. Any ideas? Thanks again.

skuli

Posted

The folderPath variable in the AppleScript holds the path to the file. You could extract the folder name from that. Define a field in your database, say, File Path, and use:

set Cell "File Path" of newRecord to folderPath

immediately after the other set Cell command.

Posted

No problem.

Can you also give some direction on how I would modify this script to read the contents of folders within the selected folder?

I have an idea that there has to be some sort of if statement to the effect of "if folder count is greater than 0", but I'm not sure. This is almost there.

Bradley

Posted

This will require a bit of recursive scripting -- let me think about it a bit, and welcome other AppleScript experts' opinions. The Troi File plug-in seems more and more like a better option! smile.gif

  • 1 month later...
Posted

I know you got all these answers and have probably already come up with a solution. I used to use applescript to complete this task, till I ran into the following simple and fast tecnique. All you have to do is open the folder, view by list, select all, copy and paste into a text editor. Save out that file and do a file/import into Filemaker and VOILA you got all the file names into a database. Of course you are limited to the amount of files one folder can see at a time (not sure of the exact amount - I just never go over 1000 at a time). It requires some intervention and/or you could write an applescript that does that function. I just find it ALOT faster than the applescript.

  • 8 months later...
Posted

I know this post was a long time ago, but I was trying to figure out how to do this and came up with a solution.. which is SOOOOOOOO SIMPLE.

All you need to do is go to a dos prompt and do the following at the desired location:

dir /b > C:filename.txt

This will create a text file at c:filename.txt (or wherever you like) with a list of all the files which you can then import into Filemaker. Then on the group import just do a field replace with the foldername.

This topic is 7814 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.