将文件(特别是照片)从Macbook复制到USB [英] Copying files (specifically photos) from a macbook to a USB

查看:61
本文介绍了将文件(特别是照片)从Macbook复制到USB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将Macbook中的文件(特别是照片)复制到USB.附言我对bash和shell以及其他所有东西都是陌生的,因此非常感谢您对如何执行该操作进行描述(如果英语不好,抱歉)

Copying files (specifically photos) from a macbook to a USB. Ps. i am new to bash and shell and all that, so a description on how to do it too is very much appreciated (sorry if bad english)

推荐答案

以下是一些可以帮助您入门的东西...

Here are some things to get you started...

您可以像这样获得外部物理驱动器的挂载点:

You can get the mount point of an external, physical drive like this:

diskutil list -plist external physical | plutil -p - | awk -F\" '/"MountPoint"/{print $(NF-1)}'

因此,如果要在变量中执行此操作,

So, if you want that in a variable do:

usb=$(diskutil ...)
echo $usb 

示例输出

/Volumes/MUSIC

您可以获得 JPG / jpg / JPEG / jpeg / PNG <用户的HOME目录中的/code>/ png 文件,

You can get a list of JPG/jpg/JPEG/jpeg/PNG/png files in the users' HOME directories with:

find /Users -iname \*.jpg -o -iname \*.jpeg -o -iname \*.png

简单地说,您现在可以对找到的每个文件执行 cp 并将其复制到USB驱动器.但是,这有一些问题-如果您在两个不同的目录中都有一个名为 a.jpg 的文件,怎么办-只有要复制的第二个文件会最终出现在您的USB上.

Simplistically, you could now exec cp for each file you find to copy it to your USB drive. However, there are some issues with that - what if you have a file called a.jpg in two different directories - only the second one to be copied will end up on your USB.

find /Users -iname   ...   -exec cp {} "$usb" \;

这篇关于将文件(特别是照片)从Macbook复制到USB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆