Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you add file extensions to a bunch of files at once?
#20
This AppleScript will display the file type and creator of any file that has one.

set my_file to (choose file)
set file_info to info for my_file

display dialog
Name:
& (name of file_info) &
&
&
Type:
& (file type of file_info) &
Creator:
& (file creator of file_info)


This AppleScript will sort files from a folder into sub-folders based upon type.

It should be pretty obvious where to change the types or add new types and folders.

set target_folder to (choose folder)

tell application
Finder

try
set wrd_folder to (make new folder at target_folder with properties {name:
WORD
})
set rtf_folder to (make new folder at target_folder with properties {name:
RTF
})
set email_folder to (make new folder at target_folder with properties {name:
E-MAIL
})
end try

set file_list to (every item of target_folder)
set folder_list to name of every folder of target_folder
set no_items to count of file_list

repeat with i from 1 to no_items
set the_file to item i of file_list as alias
set file_info to info for the_file
if folder_list does not contain (name of file_info) then
if file type of file_info contains
doc
then move the_file to folder
WORD
of target_folder
if file type of file_info contains
rtf
then move the_file to folder
RTF
of target_folder
if file type of file_info contains
eml
then move the_file to folder
E-MAIL
of target_folder
end if
end repeat

end tell

There shouldn't be any problems, but use the script on a copy of the folder just in case.
Reply


Messages In This Thread
Re: How do you add file extensions to a bunch of files at once? - by Chakravartin - 12-01-2011, 07:04 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)