首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >FileZilla和applescript

FileZilla和applescript
EN

Stack Overflow用户
提问于 2013-07-30 23:54:32
回答 1查看 1.2K关注 0票数 0

我正在制作一个applescript,它将flv和f4v文件的文件夹转换为mp4文件,然后通过filezilla将其上传到服务器。如何使用applescript通过Filezilla上传到服务器?这是我的代码:

代码语言:javascript
复制
--Install handbrakecli into /usr/bin/

--on adding folder items to this_folder after receiving these_items
with timeout of (720 * 60) seconds
    tell application "Finder"
        --Get all flv and f4v files that have no label color yet, meaning it hasn't been processed

        set allFiles to every file of entire contents of ("Macintosh HD:Users:Chase:auto_convert:nope" as alias) whose ((name extension is "flv" or name extension is "f4v") and label index is 0)

        --Repeat for all files in above folder
        repeat with i from 1 to number of items in allFiles
            set currentFile to (item i of allFiles)

            try
                --label to indicate processing
                set label index of currentFile to 3

                --Assemble original and new file paths
                set origFilepath to quoted form of POSIX path of (currentFile as alias)
                set newFilepath to (characters 1 thru -5 of origFilepath as string) & "mp4'"

                --Start the conversion
                tell application "Terminal"
                    do shell script "HandBrakeCLI -i " & origFilepath & " -o " & newFilepath
                end tell
                --Set the label to red because this is the file that has been converted 
                set label index of currentFile to 6

                --Remove the old file
            on error errmsg
                --Set the label to red to indicate failure
                set label index of currentFile to 2
            end try
        end repeat

        set extensionToFind to "mp4"

        set topLevelFolder to "Macintosh HD:Users:Chase:auto_convert:nope" as text
        set pathCount to count of topLevelFolder

        set mp4Files to files of entire contents of folder topLevelFolder whose name extension is extensionToFind
        if mp4Files is {} then return

        set mp4Folder to "Macintosh HD:Users:Chase:auto_convert:yep"

        move mp4Files to mp4Folder


    end tell
end timeout
--end adding folder items to    
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-02 09:30:50

这不是个好主意,因为Filezilla不支持applescript。我总是感到惊讶的是,网络鸭也没有。但见:

http://discussions.apple.com/thread/2588937?start=0&tstart=0

……在上面有很好的方向;在shell中卷曲,或者(在页面的末尾) URL访问脚本,这是一个应该安装在Mac上的脚本添加。URL访问脚本示例:

代码语言:javascript
复制
tell application "URL Access Scripting"
upload filepathtoUpload to "ftp://username:password@domain.com/SOME/PATH/filename.jpg" replacing yes without binhexing
end tell
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17959417

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档