Go Back   The macosxhints Forums > Working with OS X > OS X Developer



Reply
 
Thread Tools Rate Thread Display Modes
Old 11-07-2009, 02:13 PM   #1
JerseyCityMac
Prospect
 
Join Date: Oct 2009
Posts: 3
Hi, Hayne-

You're right—I didn't get a full solution, but I did find a script that will create the folders from the filenames, and then move those files into each of the newly created folders.
I still am having no luck with the second part of the routine, but here's the folder creation script for those who are interested:


set chosen_folder to (choose folder)
tell (a reference to my text item delimiters) to set {old_delim, contents} to {contents, "."}
tell application "Finder"
try
set file_list to files of chosen_folder
on error
set file_list to {}
end try
repeat with this_file in file_list
set folder_name to name of this_file
if folder_name contains "." then set folder_name to ((text items 1 thru -2 of folder_name) as string)
set new_folder to ((chosen_folder as string) & folder_name & ":")
try
get new_folder as alias
on error
make new folder at chosen_folder with properties {name:folder_name}
end try
move this_file to folder new_folder
end repeat
end tell
set my text item delimiters to old_delim

Eric
JerseyCityMac is offline   Reply With Quote
Reply

Tags
applescript, filename, folder, sorting

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:57 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Site design © Mac Publishing LLC; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of Mac Publishing LLC.