问题描述
我试图找到一个脚本来查找和移动文件到不同的文件夹中。
我有一个文件夹几百张照片是这样的:
PA-600-01.jpg,PA-600-02.jpg,PA-600-03.jpg,PA-600-04.jpg,PA-601-01。 JPG,PA-601-02.jpg,PA-601-03.jpg,PA-602-01.jpg,PA-602-02.jpg,PA-602-03.jpg,PA-602-04.jpg, PA-602-05.jpg
我想移动所有图片与 PA-600
(所以PA-600-01.jpg,PA-600-02.jpg ,PA-600-03.jpg和文件夹PA-600-04.jpg
)(新的或已有的,越容易...)名为 PA-600
,将所有的图片与 PA-601
( PA-601-01.jpg,PA-601-02.jpg和PA-601-03.jpg
)的一个文件夹命名为 PA-601
,将所有的图片与 PA- 602
( PA-602-01.jpg,PA-602-02.jpg,PA-602-03.jpg,PA-602-04.jpg和PA-602 -05.jpg
)的一个文件夹命名为 PA-602
...,直到 PA-699
我试图移动文件而不是一组文件:
告诉应用程序在别名发现者作出新的文件夹中的Macintosh HD:用户:AirYoSo:桌面:600-699具有属性{名字:PA-600}复制文件 Macintosh的HD:用户:AirYoSo:桌面:600-699:PA-600-01.jpg文件夹的Macintosh HD:用户:AirYoSo:桌面:600-699:PA-600告诉结束
不知道如何做到这一点的AppleScript中,但这是非常微不足道在bash做,你已经安装了你的Mac上:
#!/斌/庆典
为((C = 600; C< = 699; C ++))
做
回声处理PA- $ C
MKDIR -p PA- $ C
MV PA- $ C - * JPG PA- $ C /。
DONE
保存此一文件,例如 script.sh
,将文件复制到您的JPG文件的目录,这样运行它,在终端(替换/用户/莱昂内尔/与你的文件的真实路径文件):
$ CD /用户/梅西/文件
$的bash script.sh
I'm trying to find a script to find and move files to a different folder.
I've got a folder with hundreds pictures like this:
PA-600-01.jpg, PA-600-02.jpg, PA-600-03.jpg, PA-600-04.jpg, PA-601-01.jpg, PA-601-02.jpg, PA-601-03.jpg, PA-602-01.jpg, PA-602-02.jpg, PA-602-03.jpg, PA-602-04.jpg, PA-602-05.jpg
I want to move all the pictures with PA-600
(so PA-600-01.jpg, PA-600-02.jpg, PA-600-03.jpg and PA-600-04.jpg
) on a folder (new or already existing, the easier...) named PA-600
, move all the pictures with PA-601
(PA-601-01.jpg, PA-601-02.jpg and PA-601-03.jpg
) on a folder named PA-601
, move all the pictures with PA-602
(PA-602-01.jpg, PA-602-02.jpg, PA-602-03.jpg, PA-602-04.jpg and PA-602-05.jpg
) on a folder named PA-602
... until PA-699
I tried to move a file but not a group of files:
tell application "Finder" make new folder at alias "Macintosh HD:Users:AirYoSo:Desktop:600-699" with properties {name:"PA-600"} copy file "Macintosh HD:Users:AirYoSo:Desktop:600-699:PA-600-01.jpg" to folder "Macintosh HD:Users:AirYoSo:Desktop:600-699:PA-600" end tell
No idea how to do it in applescript, but this is quite trivial to do in bash, which you have installed on your Mac:
#!/bin/bash
for (( c=600; c<=699; c++ ))
do
echo "Processing PA-$c"
mkdir -p PA-$c
mv PA-$c-*.jpg PA-$c/
done
Save this to a file, for example script.sh
, copy the file to the directory with your jpg files, and run it like this, in Terminal (replace /Users/lionel/files with the real path to your files):
$ cd /Users/lionel/files
$ bash script.sh
这篇关于寻找一个AppleScript找到文件,并将其移动到不同的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!