since there is no tool on mac to sort a USB-stick (FAT32) by name to play music files in a car that cannot sort the files by itself, i want to create a little applescript to do this. There are tools like "drivesort" on Windows that can do this but since wine is not working on Catalina this is no option for me. On mac there are many tools to clean from hidden files on drives, but i haven't found any to sort a FAT by name...
my idea was to get the file list, sort it by name (if it is not) and then use the touch command to change to date of the file. as i know FAT32 stores the files not sorted but only by the time the files were added on the stick.
here is my appescript, but it errors that on the line where "a" will be set, it cannot convert into the expected type:
tell application "Finder"
set file_list to every file of entire contents of (choose folder with prompt "Please select directory.")
end tell
repeat with afile in file_list
set a to quoted form of POSIX path of afile
display dialog "aktuelle Datei: " & a as string
do shell script "touch -am " & a
end repeat
what i am doing wrong here? is there a better simplier way? many thanks!
Finder should be able to sort the files and also adjust the modification dates of each. So something like this (which I admit I haven't yet tested but will do so when I am in front of a computer):
set now to the current date
tell application id "com.apple.Finder" to repeat with f in (sort ¬
the files in my (choose folder)'s entire contents by name)
set [f's modification date, f's creation date, now] to ¬
[now, now, now + 5]
end repeat