globalSAVE_FOLDERsetSAVE_FOLDERto"movies"globalOUTPUT_FILEsetOUTPUT_FILEtoPOSIXfile(POSIXpathof(path todesktop)&SAVE_FOLDERas text)globalMOVIE_SIZEsetMOVIE_SIZEto500*1024*1024globalMOVIE_FORMATSsetMOVIE_FORMATSto{"mov","mkv","mp4","rmvb"}tellapplication"Finder"ifnot(existsOUTPUT_FILE)thenmakenewfolderat(path todesktop)withproperties{name:SAVE_FOLDER}endifendtellsetOUTPUT_FILEtoPOSIXfile((POSIXpathofOUTPUT_FILE)&"/"×tamp()&".txt"as text)-- connet remote sharing resourcemount volume"smb://10.11.8.66/IEDmovie$"asusername"larryhou"withpassword"password"-- script entrytellapplication"System Events"set_roottoalias(pathofdisk"IEDmovie$")set_listto(list folder_rootwithoutinvisibles)set_pathtopathof_roottry-- open file access if possibleopen for accessOUTPUT_FILEwithwritepermissionendtryset eofOUTPUT_FILEto0set_resultto(mylookForFiles(_path,_list))close accessOUTPUT_FILEendtellbeep2-- notification of finishing task with 2 times beepdisplay dialog"DONE!!"withiconstopgivingupafter60*2-- filter kernel-- if return true, will be kept, or discardedonprocessFile(_file)tellapplication"System Events"set_sizetosizeof_fileset_extensiontonameextensionof_file-- keep files larger than MOVIE_SIZE and with specific file extensionset_availableto(_size≥MOVIE_SIZEand(MOVIE_FORMATScontains_extension))set_dateto(modificationdateof_file)set_currenttocurrent date-- keep files modified within last monthset_availableto_availableand((_current-_date)/(24*3600)≤30)return_availableendtellendprocessFile-- search files recursivelyonlookForFiles(prefix,names)set_resultto{}tellapplication"System Events"repeatwithvarinnamesset_itemto(alias(prefix&varas text))ifkindof_itemis"文件夹"thenset_pathtopathof_itemset_listtolist folder_itemwithoutinvisiblesset_resultto_result&(mylookForFiles(_path,_list))elseifmyprocessFile(_item)thenset_itemPathtoPOSIXpathof_itemset_datetomodificationdateof_itemset_infoto(yearof_date&"-")set_infoto(_info&mysubstr(monthof_dateas text,1,3)&"-")set_infoto(_info&mypadding(dayof_date)&": ")set_currenttocurrent dateset_offsetto(_current-_date)/(24*3600)set_offsetto(_offsetasinteger)set_infoto_info&mypadding(_offset)&": "set_infoto_info&nameof_item&": "-- append file path and returnset_infoto_info&_itemPath&(ASCII character13)-- save to UTF-8 encoding fileset_resultto_result&_infowrite(_infoas string)toOUTPUT_FILEas «class utf8»
endifendifendrepeatendtellreturn_resultendlookForFilesontimestamp()set_datetocurrent dateset_resultto{}set_resultto_result&(yearof_date)set_resultto_result&(mysubstr((monthof_dateas text),1,3))set_resultto_result&padding(dayof_date)set_resultto_result&padding(hoursof_date)--set _result to _result & padding(minutes of _date)--set _result to _result & padding((time of _date) mod 60)return_resultas textendtimestamponpadding(_data)set_strto(_dataas text)repeatiflengthof_str<2thenset_strto("0"&_stras text)elseexitrepeatendifendrepeatreturn_strendpadding-- get substring from text stringonsubstr(_str,_offset,_length)set_strlentolengthof_strif_length>_strlenthenset_lengthto_strlenendifif_offset<1thenset_offsetto1endifreturntext_offsetthru(_offset+_length-1)of_stras textendsubstr