A side feature from 7zip — deleting file with long file path

7zip is a decent tool when dealing with zip files, small but powerful and green! I use it almost everyday when working on Windows system.

Today I learned it can used to delete files with long file path if you can not delete such files from Windows File Explorer.

Windows has a maximum file path limitation of 260 characters. If your application generates files with long file name with a deep directory structure, you might run into troubles to copy those files around and even to delete them.

Windows File Explorer will complain file path too long for source (or destination) folder. There is no definite way to fix or work around it, and it depends on what environment you have and what you really need to do.

With Windows 10 & 2016, there is registry key introduced (see below)

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem\LongPathsEnabled

also controlled via Group Policy at Computer Configuration > Administrative Templates > System > Filesystem > Enable Win32 long paths.

In my case, changing this registry key from 0 to 1 didn’t work. I guess something needs to be done at Group Policy level in domain?

So if trying to copy, it’s really hard to work around it if you cannot touch the Group Policy. The best you can do is to use “robocopy

For deletion, you can try 7zip’s file manager. Use it to locate the file, and use shift + delete to delete it. Without shift, the file will be put into the RecycleBin first which will fail for the same reason — long file path not supported.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s