![在 Mac 上下载的文件会在 Windows PC 上生成相应的 4 KiB 隐藏文件](https://linux22.com/image/1584572/%E5%9C%A8%20Mac%20%E4%B8%8A%E4%B8%8B%E8%BD%BD%E7%9A%84%E6%96%87%E4%BB%B6%E4%BC%9A%E5%9C%A8%20Windows%20PC%20%E4%B8%8A%E7%94%9F%E6%88%90%E7%9B%B8%E5%BA%94%E7%9A%84%204%20KiB%20%E9%9A%90%E8%97%8F%E6%96%87%E4%BB%B6.png)
出于某种原因,每当我在 Mac 上下载文件,然后在 Windows PC 上导航到该文件时,该文件总是附带一个隐藏文件,该文件的名称与下载的文件完全相同(直到文件扩展名),只是开头多了一个“._”。
例如,我下载
- 泰迪熊.png
在 Mac 上,当我在 Windows Exploder 中转到文件位置时,我看到
- 泰迪熊.png
- ._泰迪.png[隐藏文件]
这些额外的隐藏文件总是无论原始下载文件的大小是多少,大小都是 4 KiB (4096 B)。
这发生在 Windows 8.1 上......
...在 Windows 7 上...
...在 Windows XP 上...
...以及在 Windows 2000 上。
(它可能也会发生在其他 Windows 版本上,但这些是我专门遇到过的。)
这绝不无论 Windows PC 运行的是哪个版本的 Windows,在 Windows PC 上下载文件时都会发生这种情况。
删除这些幻影 4-KiB 隐藏文件是一件很麻烦的事,特别是如果我最近下载了很多文件(从而产生了很多这样的幻影文件)。
为什么每当 Windows 遇到在 Mac 上下载的文件时,它都会生成这些额外的无用文件,以及如何阻止它这样做?
(如果有帮助的话,保存文件的驱动器是 64 GB exFAT 格式的 USB3 闪存驱动器。)
答案1
FAT32 和 ExFAT 无法存储 HFS+、JHFS+ 和 AFPS 可以存储的文件的所有信息,例如扩展属性或遗产资源分叉(例如,macOS 使用 xattr 将下载的文件标记为“隔离”。
在这些文件系统上,macOS (OS X)本身将创建一个单独的文件来保存此信息,称为“AppleDouble”文件。您可以使用终端应用程序命令删除这些文件dot_clean
。以下是手册页。
DOT_CLEAN(1) BSD General Commands Manual DOT_CLEAN(1)
NAME
dot_clean -- Merge ._* files with corresponding native files.
SYNOPSIS
dot_clean [-fmnsv] [--keep=[mostrecent|dotbar|native]] [dir ...]
DESCRIPTION
For each dir, dot_clean recursively merges all ._* files with their cor-
responding native files according to the rules specified with the given
arguments. By default, if there is an attribute on the native file that
is also present in the ._ file, the most recent attribute will be used.
If no operands are given, a usage message is output. If more than one
directory is given, directories are merged in the order in which they are
specified.
OPTIONS
-f Flat merge. Do not recursively merge all directories in the
given dir. This is off by default.
-h Help. Prints verbose usage message.
-m Always delete dot underbar files.
-n Delete dot underbar file if there is no matching native file.
-s Follow symbolic links. This will follow symbolic dot underbar
files when they are found.
-v Print verbose output.
--keep=mostrecent
The default option. If an attribute is associated with a data
fork, use that. Otherwise, use information stored in the Apple-
Double file. Note that the native fork’s data is preferred even
if the data in the AppleDouble file is newer.
--keep=dotbar
Always use information stored in the AppleDouble file, replacing
any extended attributes associated with the native file.
--keep=native
Always use the information associated with the data fork, ignor-
ing any AppleDouble files.
EXAMPLES
The following is how to do an dot_clean merge on the mounted volume test,
always using the dot underbar information.
dot_clean --keep=dotbar /Volumes/test
DIAGNOSTICS
The dot_clean utility exits 0 on success, and >0 if an error occurs.
BUGS
None known.
BSD Sept 27, 2012 BSD