如何在Mac中的automator中使用不带路径的当前文件夹名称作为变量? [英] How do I use the current folder name without a path as a variable in automator in Mac?
问题描述
我正在使用Mac OSX 10.8.3.
I am using Mac OSX 10.8.3.
我在Automator中设置的工作流程如下:
I have a workflow in Automator set up that is as follows:
- 询问Finder项
- 获取文件夹内容
- 进行顺序
- 移动查找器项目
工作流程的目的是自动重命名我保存在文件夹中的一堆照片,然后将其移动到新文件夹中.
The purpose of the workflow is to automate renaming a bunch of photos that I have saved in folders then move them to an new folder.
我想获取文件夹名称并将其粘贴在变量中,并在工作流程(请参阅附件)图像的按顺序"部分的新名称"框中使用该变量.
I want to grab the foldername and stick it in a variable and use that variable in the "new name box" in the Make Sequential section of the work flow (see attached) image.
如何仅获取文件夹名称并将其分配给变量.我的示例中有一个名为"FolderName"的变量
How do I grab just the folder name and assign it to a variable. My example has a variable called "FolderName"
这是屏幕截图
推荐答案
在测试中有效:
- 询问取景器项目-将类型设置为文件夹".
- 设置变量的值-这将是从操作 1 获取的文件夹的路径.
- 运行Shell脚本-设置Pass input:作为参数.并使用 /usr/bin/basename"$ 1" 作为命令行来获取文件夹名称
- 设置变量的值-这将是所获取文件夹的文件夹名称 从操作 3 .
-
获取变量的值-将获取其值的变量设置为 path
- Ask for finder Items - set type to Folders.
- Set Value of Variable - this will be the path to the folder taken from action 1.
- Run Shell Script - set the Pass input : as argument. And use /usr/bin/basename "$1" as the command line to get the folder name
- Set Value of Variable - this will be the folderName of the folder taken from action 3.
Get Value of Variable - set the Variable it obtains the value of to path
5a.设置操作 5 以忽略上述操作 4 - Ctrl 并在操作标题上单击鼠标以获取上下文菜单
5a. set action 5 to ignore input from the above action 4 - Ctrl + mouse click on the action Title to get the Contextual Menu
获取文件夹内容-在操作 5
您可以根据需要添加移动"操作.
You can add your Move actions after as you wish.
这篇关于如何在Mac中的automator中使用不带路径的当前文件夹名称作为变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!