Entfernen von ._-Dateien aus einem Nicht-Mac OS-Dateisystem in Dropbox

842
Eric

Mit einem Macbook mit begrenztem Speicherplatz kaufte ich ein tragbares SSD-Laufwerk, um meine größeren Dateien und meinen Dropbox-Ordner zu behalten. Dies funktioniert größtenteils, jedoch fiel mir auf, dass ich bei der Migration zum Dateisystem auf diesem tragbaren SSD jetzt Tausende von ._-Dateien hatte, im Wesentlichen eine 1to1 ._-Datei in einen echten Ordner. Wenn ich also vorher picture.jpg hatte, hatte ich jetzt zusätzlich ._picture.jpg 0-Byte-Datei.

Bei Recherchen fand ich heraus, dass dies mit dem Mac zu tun hatte, der mit einem nicht-mac-journalierten Dateisystem arbeitet und diese Dateien aus einem Grund erstellt, den ich jetzt vergesse.

Also fing ich an, diese Dateien Ordner für Ordner zu löschen, aber das dauerte ewig. Ich habe Tonnen von Website-Templates, Backups, Websites ... buchstäblich tausende kleiner Dateien, jetzt mit diesen lästigen ._-Schatten.

Also musste ich einen Weg finden, alle diese Dateien zu entfernen. Meine Lösung ist unten als Antwort aufgelistet, die ich auf der Dropbox-Community-Seite bereitgestellt habe. Aber ich wollte diesen Punkt hier stellen, um zu sehen, ob jemand einen besseren Weg hatte, diese Aufgabe zu erledigen.

0
Ja, nutzen Sie das Terminal: https://www.cnet.com/de/news/terminal-fun-deleting-repetitive-files-in-os-x/ Richard vor 7 Jahren 0
Ich benutze einfach `find. -name "._ *" -print`, wenn alles gut aussieht, ändern Sie es in `find. -name "._ *" -delete`. Beachten Sie, dass Sie für Dropbox den Client anhalten und zuerst den Ordner .dropbox.cache löschen müssen. Iskar vor 7 Jahren 0

2 Antworten auf die Frage

1
Eric

The way I resolved this was to first, making a complete copy of my Dropbox onto another drive. This can be a time consuming process, at least for me, because I keep so many consulting client's websites, backups, etc which lead to thousands of small files. With the addition of all the ._ files, it doubled. My file count was in the 300,000+ range. However, after you make the backup, we can proceed.

Keep in mind, this plan assumes you ONLY use the removable drive on a Mac. If you need to share between file systems, I doubt this will work. I simply use Dropbox application itself to manage this on other devices instead of needing an all-inclusive file system.

  1. Close the Dropbox application if it is running.
  2. Backup your dropbox onto another drive (potentially time-consuming), and will include the dreaded ._ files.
  3. For integrity's sake, confirm your backup, maybe using a folder compare utility/app.
  4. Format your removable drive to athe mac journaled file system. I'm using a Samsung Portable SSD T3 1TB, formatted to a secure partition of Mac OS Extened (Journaled, Encrypted).
  5. Once your new volume is ready, open it in Finder.
  6. Copy your backup to a Dropbox folder
  7. Open the Terminal up.
  8. Change directory to your new volume's Dropbox folder, mine is PSSSD/Dropbox so the command was:

    cd /Volumes/PSSSD/Dropbox

  9. Being nervous about what I was about to do with a mass delete, I wanted to get a "WhatIf" (powershell reference), so we are going to just do a find without remove. My list was huge so I dumped it to a file. The first command below is output to the terminal, second to a file.

    find . -name '._*' find . -name '._*' > ~/Desktop/DropBox_filestodelete.txt

  10. Review the list. I had a lot of stuff in a ".dropboxcache" folder that I was unsure if I should delete or not, but gambling that cache will just be regenerated if needed, I decided to go ahead and let it delete.
  11. Here is a command that will find everything with ._ as the beginning of a file. Note that if you have real files of importance that have this same pattern, they will be deleted and you'll need to copy them from your backup to get them back. the "rm -fv" is what removes the file as it is found. The f of -fv is to delete without prompting (dangerous), and the v of the -fv is for verbose because I want to log all the files that I deleted for reference.

    find . -name '._*' -exec rm -fv {} \; >> ~/Desktop/filesdeletedoutput.txt

  12. This delete command may take some time. I actually stopped mine twice with CTRL-C but after reviewing the log file, found it was still working and I was just inpatient.
  13. The log files should be on your desktop if you hadn't already realized.
    Now start the dropbox application back up.
  14. If you used the same name for the formatted Volume and Folder as your previous Dropbox folder, Dropbox will probably start "Syncing" and "Indexing".

This will take some time. I had an issue moving my dropbox folder once where it wouldn't let me select a folder with a Dropbox folder already in it, but somehow I was able to get around that by cancelling one of the warnings/prompts and going into the Settings/Preferences of Dropbox.

You should eventually have Dropbox back up to par, without all the pesky ._ files. I again caution you when using the rm -fv or rm-rf as it will delete without warning and I believe bypass the trash or recycling bin.

0
David Anderson

Das Betriebssystem macOS enthält den dot_cleanBefehl, der die in Ihrer Frage beschriebenen Probleme behandelt. Die Manpage von macOS 10.13.3 (High Sierra) ist unten angegeben.

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