Showing posts with label Windows 7. Show all posts
Showing posts with label Windows 7. Show all posts

23 Feb 2016

When deleting files - Source Path Too Long

In Windows, when deleting folders/files have you seen this error message:

Source Path Too Long
The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation.


Windows 8.1 screen shot - it varies depending on your version of Windows.


If copying not deleting?
If you received a similar message when copying files, please see a previous article I wrote on how you may use RoboCopy to help in that scenario:
http://mgxp.blogspot.ch/2015/10/when-copying-files-source-path-too-long.html


Why?
It's due to a limitation of 256 characters of the folder and file name length combined.


Solution
To delete a folder that contains many sub-folders and files with very long file names, there are a few solutions out there including some third-part tools. You could also use the SUBST command to shorten the path but that may not be successful depending on the length of the files/folders you have. However, I've discovered that it's possible to use RoboCopy, the free command line tool that comes with Windows to do the job perfectly!

RoboCopy is for copying files or synchronising folders. I've written a few articles on this tool already - click here for more information. RoboCopy can understand and work with file paths longer than 256 characters. RoboCopy allows you to synchronise folder 'A' with folder 'B'. Imagine that folder 'A' is empty, there are no files in it - if we synchronise that folder with a folder that does have files (folder 'B') then that folder will also be empty. That's the solution. The following is an example of how this works in practice.


Example
I have a folder called 'Folder with very long names'. Inside this folder I have many nested sub-folders with long names. Inside those sub-folders I have many files with very long names. When I try to delete the folder (and sub-folders/files) I get the 'Source Path Too Long' error. 

At the same level of the folder I want to delete 'Folder with very long names', create a new folder called 'Empty':


The folder called 'Empty' will have nothing in it (it should be empty!). 

Open a command window (press Win+R and type CMD [Enter])

At the command prompt change to the same drive/folder where you have the folders 'Empty' and 'Folder with very long names'. 

At the command prompt type the following command:
ROBOCOPY Empty "Folder with very long names" /MIR  [Enter]

The contents of the folder 'Empty' will be mirrored (/MIR parameter) to the folder 'Folder with very long names'. Because the folder 'Empty' has nothing in it, the contents of the destination folder 'Folder with very long names' will end up with nothing in it! Perfect! Now you can remove (delete) the folder yourself without any trouble.


Conclusion
It's very annoying that Windows doesn't properly support folder and file names longer than 256 characters. It's as if they added the functionality and forgot to update all the tools. Even if you try the command line DEL command you can't delete a folder with very long folder/file names. Using RoboCopy is hassle free, it works. Again it has come to the rescue because it can also solve this issue for copying files


16 Oct 2015

When copying files - Source Path Too Long

In Windows, when copying files have you seen this error message:

Source Path Too Long
The source file name(s) are larger than is supported by the file system. Try moving to a location which has a shorter path name, or try renaming to shorter name(s) before attempting this operation.

Source Path Too Long
Windows 8.1 screen shot - it varies depending on your version of Windows.

It's due to a limitation of 256 characters of the folder and file name length combined. 

The simplest solution I've found to this issue is to use RoboCopy to copy the files. It ignores the 256 character limit and just copies everything, no questions asked!

From the command line (CMD):
ROBOCOPY [source] [destination] /s  

For more help please have a look at the following article about RoboCopy:


28 Apr 2015

Windows 8 and 7 - Show file extensions

If you can't see file extensions in explorer, here's the answer:


Windows 8.x
Start File Explorer (right click Start and click File Explorer)
Click the View tab
Click File Extensions - see the example below:




Windows 7
Start Windows Explorer (double click My Computer)
Click Organize
Click Folder and search options
Click the View tab (Folder Options window)
Click to disable (remove the tick) from 'Hide extensions for known file types' - as below:




Also in Control Panel
For both Windows 7 and 8 you can find Folder Options in Control Panel. Open Control Panel and search for "folder options" - you'll see the above window (Windows 7 or 8, it is the same from Control Panel).



Reference