Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

can't copy folders & Files with long names

Posted on 2014-08-14
20
Medium Priority
?
3,681 Views
Last Modified: 2016-11-28
I have a shared lun that is accessible to users, each user is mapping it on their Windows 7 Pro X64 machine and adding their projects to it on daily bases

I am running into problems when I am trying to archive some of the folders into a server 2008 R2 Raid drive. The error is about the file name is too long and can't be copied.
The users are using description in the file/ folder name so they can search it faster in the future and for me to shorten the name is not always easy as they use detailed description.

Educating the users won't help me. How can I stop users from creating long folder or file names? If the file name is too long, then Windows should have stopped them in the first place, Why does Windows complains only when I copy them?

What other IT guys are doing to fix this issues?
0
Comment
Question by:smaguire
  • 9
  • 6
  • 2
  • +2
20 Comments
 
LVL 29

Assisted Solution

by:becraig
becraig earned 900 total points
ID: 40262395
How long is the path the file is being copied to ?

File name + path here might be what is blocking you.

Try simply moving the files to the root of the folder / or map a drive as the destination path / or simplify the destination folder to have the least number of characters possible.

Windows does have a 255 character limit if memory serves correctly.

You can probably write a quick script to rename files longer than 250 characters to drop enough characters to be 240 and then do your backup.
0
 
LVL 39

Assisted Solution

by:Aaron Tomosky
Aaron Tomosky earned 200 total points
ID: 40262396
It's a really annoying problem with windows. If the structure permits, you can map a drive deep in the folder structure to shorten the overall length. Also I believe that robocopy functions well with the long path when other programs fail. Personally I've used rsync to backup some ridiculously deep file structures and never had a problem. Can you mount the lun on a linux/unix system? I've never tried this route, but a windows rsync client might also function well
http://www.rsync.net/resources/howto/windows_rsync.html
0
 
LVL 93

Assisted Solution

by:nobus
nobus earned 400 total points
ID: 40262505
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:smaguire
ID: 40263070
our users have a very complicated folder structure and they use description in their folder & file naming so it's easy for them to find a particular file(s) or folder(s) by searching from within windows explorer search box, so renaming them is out of the question.
let us say, If they map my lun on their drive as drive F:\Engineering\
and inside that engineering folder: project1, project2, ...etc. (a project folder can be as big as 20 GB!! their engineering software use a lot simulation objects, movies, pictures,..etc and their objects gets saved by the software with a very long name)

when I am trying to copy everything in dirve F:\ into another drive on another server let us say: E:\Archived\

I think this is my problem but don't have a clear idea on how to approach it. If the user have already created a 255 character long on their drive F:\ , coping it over to drive E:\Archived\ , would complain because 255 characters + the length of "Archived\" would be more than the allowable 255?

and the problem is not by removing the "Archived" folder either, because some users would map their drive two or three level deeper into the folder structure.

I am looking for a solution that would prevent the user from creating long files rather then renaming it myself after they are being created.
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 900 total points
ID: 40263091
The easiest solution is just to tell them not to.

Your problem here is not just the long files names but the paths you need to use for your archiving.

To be frank, if the names allow them to search I cannot see how trimming the last 10 characters could have an impact (yes they may find multiple files with similar names but I am guessing time stamps would fix that)

Simply let your users know that files names longer than (x) will be trimmed as a part of the archival process and them simply perform that step when copying - File name length (minus) path length equal the new length of the name.
0
 

Author Comment

by:smaguire
ID: 40263110
Its like telling your kids not to eat candies, it will not work for a long term.

I can't trim because sometimes the last 10 characters are files like this: 1234567.doc or .pdf or...etc so a whole file will be removed!

I will try mapping a drive two level deeper into the structure and see if I can copy then...
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 900 total points
ID: 40263119
No we can set the trim to not move files with names shorter than ten.

The idea will be we do a simple script

if the length of the file name + the length of the destination is  longer than 255 then trim, else just copy.
0
 

Author Comment

by:smaguire
ID: 40263190
What I don't understand is how could they have created it in the first place and violated Windows 255 naming limit? I mean I also tried to duplicate one of the projects that is giving me grief in the original drive and it complained about some folders are too long to be copied.

Is there a free software that would scan a folder and let you rename the invalid ones to any name or to a specific name that you guys are aware of?

Thanks
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 900 total points
ID: 40263204
I don't think they actually have files named longer than the limit, I think as indicated above when you try to copy the new name + destination path included is longer than windows allows.

Here is a piece of software:
http://alternativeto.net/software/path-too-long-pro/

Nobius also has a good recommendation:
http://www.experts-exchange.com/Networking/Network_Management/Q_28497775.html#a40262505

I am sure there are many others.

You can also probably write a script of your own to do this if you wanted to (or ask a question on here and have one of the experts do it for you).
0
 
LVL 21

Assisted Solution

by:SelfGovern
SelfGovern earned 500 total points
ID: 40263230
Think of the name length problem like a power strip with six outlets.  The circuit and power strip are rated for 20 Amps, and no single device you plug into it will be more than 15 Amps -- but you can sure as heck plug six 10-Amp devices into the strip and overload it.  Likewise, there's an overall "path length limit" in Windows, and there's also a limit for length of an individual file or directory.  Similar to the power strip example, when you add up the length of the file name and the length of the directory names, you can exceed the path length limit.  Can you make the full path on the network share shorter?

Perhaps your best solution -- other than shortening path names, if possible -- is to run a script before you do the backup, and let the script shorten the file names in the directory *only if needed*... then back the files up.  Note: The file name shortening is not, perhaps, as simple as it might seem at first glance; you'll be tempted to whack the last ten (or whatever) characters off... but what if that would give you two files with the same name?  You've got to make sure there's error checking, and an alternate scheme that will ensure that you don't end up with file names still too long, etc.
0
 

Author Comment

by:smaguire
ID: 40263235
That's what I thought but after more testing it still doesn't make sense:
this is what I have:
F:\Archived\Project1

I am trying to copy it to:
F:\

to the root folder, and still complains about the file is too long to copy to the destination? how is this possible?

That software is for commercial use.
0
 
LVL 29

Assisted Solution

by:becraig
becraig earned 900 total points
ID: 40263238
Give this one a go as well it might work well for you.

http://longpathtool.com/
0
 
LVL 21

Assisted Solution

by:SelfGovern
SelfGovern earned 500 total points
ID: 40263252
You see the target directory as F:\ -- but how does Windows represent that internally?  It's very likely stored as something like \\servername\directory -- in which case, the length of your server name could be tipping the scales.  I haven't been able to find a definitive answer in a quick search, and it probably doesn't matter; the main thing is that it's not working, and the second thing is to get you working.  Worrying about why it's not working should be much further down on the list.
0
 
LVL 93

Assisted Solution

by:nobus
nobus earned 400 total points
ID: 40263261
did you try the software i posted?
also post an example of the complete file long path
often you can rename it easily to shorten up
 
C:\Users\username\Documents\WinMail\Local Folders\Geïmporteer 8b7\Herstelde b  29\11-05-2010  823\Local Folders\Herstelde b  29\11-05-2010  823\Local Folde 8be\Sent Items
can be renamed to
C:\Users\username\Documents\WinMail\Local Folders\renamed\Sent Items
0
 

Author Comment

by:smaguire
ID: 40263265
SelfGovern,

you are right but regardless of how Windows is looking into the F:\ drive. The projects with long names are sitting in the same drive and if it was created in F:\Archived\Project1 then I *Should* be able to copy it to a shorter path (to the root) within the same drive F:\
0
 

Author Comment

by:smaguire
ID: 40263275
nobus,

not yet as doesn't work and I have download some frameworks to get it installed. I might have to wait until after hours in case the frameworks installation would want to reboot the server.

I am talking about hundreds if not thousands of nested folders and files, it would take for ever to shorten them manually
0
 
LVL 29

Accepted Solution

by:
becraig earned 900 total points
ID: 40263287
I still think a quick powershell script would be best in this instance where you have control and can do multiple renames on the fly etc.

If you want to go that path, let us know.
0
 

Author Comment

by:smaguire
ID: 40263300
nobus, I tried the software, it says "Please buy full version to perform operation
0
 

Author Comment

by:smaguire
ID: 40263331
becraig,
it might be the only solution for now...
0
 

Author Closing Comment

by:smaguire
ID: 40263371
Awarded points for participation, I will be posting another question for writing script on how shorten long file names and folder

thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
IF you are either unfamiliar with rootkits, or want to know more about them, read on ....
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question