Deleting files with “too long filenames” in Windows

If you’re using Microsoft Windows and happen to have a file that has a very long filename, more than 260 characters to be percise, you’re living in a hell… Nothing can be done with it! Unless you use a great little tool of course, Robocopy!robocopy

Robocopy is an old product that comes with Windows since Vista (i think?) an can be accessed via Powershell. The thing with Robocopy is that it’s main purpuse is to copy files in one way or another. It has a feature for Mirroring one folder to another. With that said, what happens when you mirror an empty folder with a folder containing files with names too long? You get two empty folders! :) Life’s good!

The basic command for doing this is:
robocopy.exe c:\My\Empty\Folder c:\Folder\With\Long\Names /MIR

What I used this for was cleaning up the INetCache folder that had gone wild and crazy and gave the users alot of problem.
The script I used to clean this folder was:
Get-ChildItem X:\Profilefolder | foreach {robocopy X:\Empty (“X:\Profilefolder\” + “$_” + “\AppData\Local\Microsoft\Windows\INetCache”) /MIR}

This just lists all entries in X:\Profilefolder and handles each entry with a robocopy command that is mirroring the empty folder with the INetCache folder.



Allow VMs when XenServer is virtual

Not applicable for production environments, but for lab purpuse this is excellent!

Assuming you have a MySQL server on the management server, login as root on the management server.
Type in: mysql to open the mysql console.
Type in: insert into cloud.configuration (category, instance, component, name, value, description) VALUES (‘Advanced’, ‘DEFAULT’, ‘management-server’, ‘xen.check.hvm’, ‘false’, ‘Allow XenServer on XenServer HVM’);

This makes the CloudPlatform not check for the HVM type.