I’m making an archive application that zips giant project folders and drops an accompanying text file next to it with the text of all the file names in said folder. I then add that text as metadata in our metadata manager (which has a 65,000 character limit). I was taking that text variable and then dumping it into a text file via the echo terminal command. In practice it’s been giving me frequent errors like
I’m guessing this is something to do with illegal file names in the project files being a problem in Terminal. Is there a way around this? I tried textedit but I was having a tough time getting the file to save. It would also be nice to keep things in terminal. Thanks for your help! Donated to macscripter today! It’s been a lifesaver
on open droppedItems
tell application "Finder"
set archivePath to "/Volumes/SAN/Post_Transcoding/CustomTranscoding/VirtualAE_DO_NOT_DELETE/ArchiveZip"
set folderList to every item of droppedItems as list
repeat with i from 1 to count of folderList
set theFolder to item i of folderList
set theFolderColonPath to POSIX file (do shell script "dirname " & quoted form of POSIX path of (theFolder)) as string
set theFolderPath to POSIX path of theFolderColonPath
set AppleScript's text item delimiters to space
set file_list to name of every file of entire contents of theFolder as text
set spaced_list to file_list as string
set AppleScript's text item delimiters to ""
if (count spaced_list) > 65000 then
display dialog "You have too many characters of metadata, please break up into smaller zip files."
return
end if
do shell script "cd " & theFolderPath & " && zip -r -3 " & (archivePath) & "/" & (name of theFolder as text) & ".zip" & " " & (name of theFolder as text)
do shell script "echo '" & file_list & "' >" & archivePath & "/" & (name of theFolder as text) & ".txt"
end repeat
end tell
end open