Pet*_*uza 19 windows partitioning macos
有没有办法阻止 Mac OS X 在 NTFS 和 FAT 等外部卷上创建 .DS_Store 和其他隐藏的元文件?我在 Mac OS X 和 Windows 之间共享一个 NTFS 分区,其中包含 Thunderird & Firefox 的配置文件和 apache 的 DocumentRoot 等数据,这非常方便。我不介意 Mac OS X 是否不能索引或以其他方式做那些元文件的整洁事情。
注意:它不通过网络共享,操作系统和共享分区在同一台机器上的同一磁盘上共存。
Ric*_*ins 21
如果您通过网络共享 NTFS 分区,使用 SMB 或其他类似工具,您可以将其关闭。
defaults write com.apple.desktopservices DSDontWriteNetworkStores true
Run Code Online (Sandbox Code Playgroud)
Apple 技术公告“如何防止通过网络连接创建 .DS_Store 文件”。我还没有证实这仍然适用于雪豹。
小智 6
当我对同样的问题感到恼火时,我使用了它,我设置了一次。这种方法使系统自动执行所有操作。
通过打开终端创建一个名为 Remove_Hidden_Files.sh 的脚本,例如 cd ~/Documents 并输入 touch Remove_Hidden_Files.sh
使用 vi 创建脚本。在终端类型vi Remove_Hidden_Files.sh
按“I”进入插入模式并输入以下内容(提示#按alt和3)
#!/bin/bash
# Removing the hidden files from my drive using the find command. Change xxx to the name of your external volume or path you wish to run the command on.
# the -mount will stop the find command going to other volumes other than specified.
find -x /Volumes/(xxx) -mount -name '.DS_Store' | xargs rm -rf
find -x /Volumes/(xxx) -mount -name '.Spotlight-V100' | xargs rm -rf
find -x /Volumes/(xxx) -mount -name '.Trashes' | xargs rm -rf
find -x /Volumes/(xxx) -mount -name '._.Trashes' | xargs rm -rf
find -x /Volumes/(xxx) -mount -name '.fseventsd' | xargs rm -rf
Run Code Online (Sandbox Code Playgroud)按 Esc 退出插入模式并按住 shift 并按 :
键入wq!然后按ENTER键
使脚本可执行 chmod 775 ~/Documents/Remove_Hidden_Files.sh
对此进行测试以确保其有效。您可以通过打开终端并输入 cd /Volumes/(xxx) 并按回车键然后 ls -la 列出所有文件来轻松完成此操作,如果不使用查找器导航到该卷,您应该会看到一个 .DS_Store 然后重复该命令你应该在那里看到一个。
按命令键和 N 打开另一个终端
类型 cd ~/Documents
类型 sh Remove_Hidden_Files.sh
转到另一个终端窗口并检查 .DS_Store 文件是否已删除。
创建启动守护进程。这意味着自动运行,因此您无需执行任何操作。
最好的方法是下载 lingon
为您的用户帐户创建一个守护进程并将其命名为 com.remove_hidden_files.Launchd
在命令框中键入 sh ~/Documents/Remove_Hidden_Files.sh
您可以输入路径或浏览到它 /Volumes/(xxx)
重启机器试试
请注意,如果您重命名外部驱动器,请使用不同的命名驱动器或路径,您将需要更改脚本。
| 归档时间: |
|
| 查看次数: |
25621 次 |
| 最近记录: |