2017-03-23 - By Robert Elder
Next time your co-worker asks:
"What's the best way to back up my Eclipse workspace on Windows?"
you can tell them "Just right-click on it and select 'Send to Compressed (zipped) folder' and save the zip file". Unbeknownst to them, you just pulled the ultimate prank by telling them to make a corrupted backup!
What your friend probably doesn't realize is that the Windows 'Send to Compressed (zipped) folder' utility has a mandatory optional feature to automatically not include certain folders in the archive without telling you. This is a great feature because it demonstrates the excellent sense of humour that the authors of Microsoft Windows have. This feature was no doubt included to allow you to play a variety of hilarious pranks on others by causing them lose data, only to find out about it years later when they want to open the archive and recover it.
Here's how the silent corruption feature works. Just right-click on your eclipse workspace and select 'Send to Compressed (zipped) folder'.
Next, extract the Eclipse workspace files that you just compressed and compare the differences:
Note that the '.plugins' folder is missing. Now when you open this workspace with Eclipse, you'll get behaviour that looks somewhat like it has 'forgotten' all of your projects. You can go and import them, but various other settings are likely to be still broken.
Folders Starting With Dot Are Omitted...Sometimes
The 'Send to Compressed (zipped) folder' feature will omit any directories that start with a period character. But wait, the '.metadata' directory in the Eclipse workspace starts with a period and it was successfully included in the archive, so what gives?
I did a bit of experimenting and it appears that only directories after the first directory are omitted. This is probably why the '.metadata' folder itself is still included in the archive even though it starts with a dot. Here's what you get if you include a bunch of files and folders that start with a period:
Creating Files That Start With Dot In Windows
This feature of omitting directories that start with a period is probably related to the feature of Windows explorer that prevents you from creating a file or folder that starts with a dot:
unless you also end the file name with a dot:
and also the ending dot gets deleted after the file or folder is created:
Folders created using this method also seem to have the same behaviour mentioned above when zipping them inside archives. As far as I can tell, this feature is recursive, meaning that only the first directory starting with a dot will be added to the archive no matter how many directories deep it is.
The 'Send to' feature also has some unique behaviour when zipping files that contain unicode in their names:
How To Actually Zip Dot Files?
Programs like 7-zip or other common specialized zip utilities don't seem to exhibit the same behaviour of omitting folders that start with a period.
Does It Work On Linux?
Unfortunately, I was unable to get this feature to work on Linux. This only serves to further prove that people who use Linux are boring and don't have much of a sense of humor.
In this article we've reviewed a method of pranking your friends by convincing them to create a zip archive that omits potentially important directories using Microsoft Windows' built-in archive creation utility. This feature of the archive utility is sure to bring you hours of fun and entertainment. You could probably even start your own YouTube channel where you catch people on a hidden camera as they discover that their vital backups are missing data. After they express disappointment, you can jump out and say to them: "It was just a prank!".
The Regular Expression Visualizer, Simulator & Cross-Compiler Tool
Why Is It so Hard to Detect Keyup Event on Linux?
Myers Diff Algorithm - Code & Interactive Visualization
Interfaces - The Most Important Software Engineering Concept
Regular Expression Character Escaping
How Do Regular Expression Quantifier Work?
Overlap Add, Overlap Save Visual Explanation
Why Bother Subscribing?