Skip to content

Cleanup and reuse unused Copy&Paste disk space occupied by VMware

Whenever you Copy&Paste (or Cut&Paste) something into or from a VMware instance, the software first copies the files into a temporary directory and later on sends the copy/move job to Windows. Since the Windows task is asynchronous, VMware has no chance to find out when this actually finishes - so it is supposed to clean up this temporary directory at boot time.

However, waiting for the next reboot can clog up quite some disk space (when I develop something I often have to copy many files around between several virtual machines and the desktop) - despite that Windows still likes to BSoD on me from time to time. And sometimes VMware does not get the cleanup right at reboot and the files are still there.

So I wrote myself a little Cygwin shell script (you should really consider installing Cygwin when you have to work on Windows) and the execution of this script is scheduled every night by the Windows Scheduler.

First create a shell script "" in "<your folder>\AppData\Local\", with the following content:

set -e
cd /cygdrive/c/Users/<your username>/AppData/Local/Temp/vmware-<your username>/VMwareDnD || exit 1
/usr/bin/find . -depth -mindepth 1 -maxdepth 1 -type d -mmin +720 -exec /usr/bin/rm -rf {} \;

Then follow the instructions in these screen shots to install this script in the Windows Scheduler:

Open the "Control Panel", search for "Schedule"

Click on "Create Basic Task"

Enter a descriptive name (I used "Cleanup VMwareDnD directory" here)

Select "daily" when asked for the scheduling frequency

Enter a time which fits your requirements, early in the morning is just fine for me

Select "Start a program" when asked for the scheduling action

Enter the path to the Cygwin Bash shell, specify the path to the script as option

Windows asks you to separate program and parameters, agree here

If everything is ok, press "Finish"

Make sure you can see your new job in the "Active Tasks" list

Voila, now Windows will clean up old entries not only when you restart the operating system. The script above removes all directories which data was last modified 720 minutes ago, or more. That's 12 hours - should be reasonable enough.


No Trackbacks


Display comments as Linear | Threaded

No comments

Add Comment

Enclosing asterisks marks text as bold (*word*), underscore are made via _word_.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.
To leave a comment you must approve it via e-mail, which will be sent to your address after submission.
Form options