goo blog サービス終了のお知らせ 

WORK備忘録

メモ

ファイル名検査

2018-02-12 18:20:51 | 日記


on open dorp_Items

tell application "Finder"

--set theFolder to (folder "demofile" of desktop) as alias
set theFolder to (item 1 of dorp_Items) as alias

set pPath to POSIX path of theFolder as string

end tell



set kensafile_count to do shell script "ls -1 " & pPath & " | wc -l"

set ayamari_fairumei to ""

try
set ayamari_fairumei to do shell script "ls -1 " & pPath & " | grep -v '[1-9][1-9][1-9][A-Z][1-9][1-9][0-9].pdf'"

on error e
if (e = "0 以外の状況でコマンドが終了しました。") then
set ayamari_count to 0
end if
end try

set ayamari_count to count of paragraph of ayamari_fairumei


if ayamari_count = 0 then

tell application "Finder"
set label index of theFolder to 6
end tell

display dialog "検査フォルダ:" & return & tab & pPath & return & "検査ファイル総数:" & return & kensafile_count & return & "誤りファイル数:" & return & tab & ayamari_count & return & return & "ファイル名に誤りはありませんでした。" buttons {"OK"}
else


repeat with i from 1 to ayamari_count
set ayamaru_list to paragraph i of ayamari_fairumei
tell application "Finder"
set label index of (file ayamaru_list of theFolder) to 2
end tell
end repeat
tell application "Finder"
set label index of theFolder to 2
end tell

display dialog "検査フォルダ:" & return & tab & pPath & return & "検査ファイル総数:" & return & kensafile_count & return & "誤りファイル数:" & return & tab & ayamari_count & return & return & ayamari_fairumei buttons {"OK"}
display dialog "ファイル名を速やかに修正して下さい" buttons {"OK"} with icon stop
end if
end open


最新の画像もっと見る

コメントを投稿

サービス終了に伴い、10月1日にコメント投稿機能を終了させていただく予定です。