2016-04-19 21 views
1

私は、Googleドキュメントでファイルを編集し続けるために、.docxファイルが共有されているGoogleドライブにフォルダを持っています。 Googleドキュメントでは、拡張子が.gdocのドキュメントが作成されるので、今度は"test.docx""test.docx.gdoc"と呼ばれるように、すべてのドキュメントを2回作成するようになりました。今すぐ同じ名前の.docx.gdocファイルが存在するとすぐに.docxファイルを自動的に削除します。 applescript:同じ名前のファイルが存在する場合、フォルダ内のファイルを自動的に削除します。

は、私はこの1つを試してみましたが、それは.docxのファイルは削除されません:私はすべてがライン

set gdocFile to baseName & ".docx.gdoc 

ラインまで動作することを比較的確信している私のテストで

on adding folder items to this_folder after receiving added_items 
    tell application "Finder" 
    set docxFiles to every file of this_folder whose name extension is "docx" 
    repeat with aFile in docxFiles 
     set baseName to text 1 thru -6 of (get name of aFile) 
     set gdocFile to baseName & ".docx.gdoc" 
     if exists gdocFile then delete aFile 
    end repeat 
end tell 
end adding folder items to 

を何もしていないと思われる

if exists gdocFile then delete aFile 

すべてのアイデア?あなたは完全なパスなしで.docx.gdocファイル名を構成しているので、これは動作しないことができる

+0

私はあなたのスクリプトがそれ以上の仕事をしていると思います。あなたはすでに受信したばかりのファイルをキャプチャしています。それらのファイルをループして、他のファイルの存在を確認してください。 – ThrowBackDewd

+0

「うまくいきません」に関しては、何が問題なのでしょうか?より多くの情報を提供できますか? – ThrowBackDewd

答えて

0

この

on adding folder items to this_folder after receiving added_items 
    tell application "Finder" 
     set docxFiles to every file of this_folder whose name extension is "docx" 
     repeat with aFile in docxFiles 
      set gdocFile to (aFile as text) & ".gdoc" 
      if exists file gdocFile then delete aFile 
     end repeat 
    end tell 
end adding folder items to 

を試してみて、私はそれを他の方法でラウンドを行うだろう。 .docx.gdocファイルを繰り返し処理し、対応するdocxファイルを削除してください。

+0

ヴァディアン、あなたは私の一日を作った!本当にありがとう! –

関連する問題