0

我尝试制作一个读取文件夹中文件并且只占用文件名的一部分的applescript。这些文件看起来像这样:the.name.of.a.tv.show.s01e01

我可以搜索 s01,但我必须为每个可能到来的季节制定规则。

有没有办法查找 s--e-- 然后在此之前获取文件名的一部分?

4

1 回答 1

0

尝试:

set xxx to "the.name.of.a.tv.show.s01e01 etc etc"
set yyy to (do shell script "echo " & xxx & " | sed 's/.s[0-9][0-9]e[0-9][0-9].*//'")
return yyy

结合您之前的问题:

set seasonList to {}
repeat with aShow in listOfShows
set aShow to aShow as string
set end of seasonList to (do shell script "echo " & aShow & " | sed 's/.s[0-9][0-9]e[0-9][0-9].*//'")
end repeat
return seasonList
于 2012-04-09T14:02:08.043 回答