Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9208329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:35:34+00:00 2026-06-18T00:35:34+00:00

I have an Applescript question that is much more complex than I can construct.

  • 0

I have an Applescript question that is much more complex than I can construct. I have been searching for the past couple of days, and I cannot find any script like this, nor can I find enough information to piece one together with my limited knowledge.

I have multiple files with structured names. Each file has the following name structure:

ttu_collectionname_000001.pdf
ttu_collectionname_000002.mp3
ttu_collectionname_000003.pdf … etc. (Each of these files are of varying file types.)

There is also a csv metadata file associated with each of the original files.

ttu_collectionname_000001.csv
ttu_collectionname_000002.csv
ttu_collectionname_000003.csv … etc. (Each of these files are csv files.)

I need to create a folder based on the name of the file with sub and sub-subfolders. Each top-level folder name will be unique in the number sequence. Each sub and sub-subfolder name will be the same for each top-level folder.

The folder structure should look like this:

  • ttu_collectionname_000001
    • content
      • archive
      • display
    • metadata
      • archive
      • display
  • ttu_collectionname_000002
    • content
      • archive
      • display
    • metadata
      • archive
      • display

I then need to move the each file to a particular sub-subfolder.

The file ttu_collectionname_000001.pdf would be moved to the ttu_collectionname_000001/content/display folder.

The file ttu_collectionname_000001.csv would be moved to the ttu_collectionname_000001/metadata/display folder.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T00:35:35+00:00Added an answer on June 18, 2026 at 12:35 am

    Try:

    set myFolder to "Mac OS X:Users:stark:Main Folder"
    tell application "Finder" to set myFiles to folder myFolder's files as alias list
    repeat with aFile in myFiles
        tell application "System Events" to set {fileName, fileExt} to {name, name extension} of aFile
        set baseName to text 1 thru ((get offset of "." & fileExt in fileName) - 1) of fileName
        do shell script "mkdir -p " & (quoted form of (POSIX path of myFolder)) & "/" & baseName & "/{\"content\",\"metadata\"}/{\"display\",\"archive\"}"
        tell application "System Events"
            if fileExt is "pdf" then move aFile to (myFolder & ":" & baseName & ":content:display" as text)
            if fileExt is "csv" then move aFile to (myFolder & ":" & baseName & ":metadata:display" as text)
        end tell
    end repeat
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to write some applescript that checks to see if the
I have an applescript that reads data from a CSV (successfully!). After my script
I have an AppleScript script that I use to display iTunes track information on
I have app created (Cocoa-AppleScript Application) that executed a shell command using the value
I have an applescript that gets a string at one point and checks if
I have this applescript that takes the selected item and zips that file/folder and
I have an application that can import an XML file through this terminal command
I have tried to make an AppleScript that is supposed to read the current
So I have simple applescript that returns (return test) the following: NSAppleEventDescriptor: 'utxt'(test) I
I have an applescript that refuses to run on any excel files I feed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.