I have AppleScript code which returns Folder name, creation date, filename, modification day, date, time, and repeats thru sub folders. Now I need to do the same task in Automator.
This AppleScript.app worked when code was built as an app on several Folders…
property file_id : null
--set this_folder to (path to me)
set this_folder to choose folder with prompt "Choose the root folder"
set log_file_path to (path to desktop as string) & "Folder Inventory List.txt"
set file_id to open for access file log_file_path with write permission
--write ("Start " & (current date) & return) to file_id starting at eof
my do_subfolders(this_folder, "")
write (return) to file_id starting at eof -- write (return & return) to file_id starting at eof
close access file_id
display dialog "Finished"
return
on do_subfolders(this_folder, name_prefix)
tell application "Finder"
log name_prefix & (name of this_folder) as string
write (return & name_prefix & (name of this_folder) as string) to file_id starting at eof
set file_list to every file in this_folder
repeat with this_file in file_list
get creation date of this_file
log name_prefix & " " & (name of this_file) as string
write (return & name_prefix & " " & (name of this_file) & " " & (creation date of this_file) as string) to file_id starting at eof
end repeat
set folder_list to every folder in this_folder
repeat with this_subfolder in folder_list
my do_subfolders(this_subfolder, " " & name_prefix & " " & (creation date of this_file))
end repeat
end tell
end do_subfolders
returning text like this…
[format]_Book 1.8
Thursday, 16 January 2020 at 14:47:04
VFC-PS
Thursday, 16 January 2020 at 14:47:04 SassoBoo.vfc Wednesday, 11 March 2020 at 18:39:16
Thursday, 16 January 2020 at 14:47:04 SassoBooIta.vfc Wednesday, 11 March 2020 at 18:38:55[/format]
But started to produce errors when run more than 8 times…
The variable this_file is not defined.
The variable this_file is not defined. (-2753) , which displayed the Folder names in the txt file but no Contents.
Rebuilding as an .app in AppleScript Version 2.2 (2.2) it won’t run as its not a PowerPC app.
So pasting the AppleScript code into the Automator Action “Run AppleScript”, I get…
Syntax Error
File file Macintosh HD:Users:adrianshome:Desktop:Folder Inventory List.txt is already open.
But it created a .txt file and which displays the Folder name, _Book 1.8 but nothing else.
Any help will be much appreciated,
Adrian