How on earth can this be done?
From a dialog, I just want to choose a folder and get that folders name (or disk name) and its subfolder saved into a text file.
Good luck!
How on earth can this be done?
From a dialog, I just want to choose a folder and get that folders name (or disk name) and its subfolder saved into a text file.
Good luck!
Check out the finder’s dictionary… you can get it to tell you the contents of folders as list and then you can dump the list to a text file. Or you could do shell script ls.
Well…there are several items, classes and commands in the Finder dictionary but I believed it would be easier just asking the experts…
Your hunch serves you well…
set theFolder to choose folder
tell application "Finder" to set Subs to folders of theFolder
set SubsTextFormat to {}
repeat with thisfolder in Subs
copy (thisfolder as string) & return to the end of SubsTextFormat
end repeat
set append_data to true
set the target_file to ((path to desktop as string) & "FolderData.txt") as string
set this_data to (("*Item:" & return & theFolder as string) & return & "*Contains sub-folders: " & return & SubsTextFormat as string) & "--------------------------" & return--Item is used to refer to disks or folders
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
try
close access file target_file
end try
That will put the text file on your desktop. You can change the name above @ “FolderData.txt”.
To keep a log going I set append_data to “true”, if you want the file overwritten then set this to “false”.
SC
Thank you Sitcom
Hope you get paid in the after life