Ryno Posted February 12, 2015 Posted February 12, 2015 Hi, We have a staff shared area that is 1TB. I am trying to move it from a Qnap NAS to a windows 2012 r2 server. The only problem is teachers have put folders inside of folders and they are silly long. I am wondering what you would all do in this situation? Thanks, Ryan
Ephelyon Posted February 12, 2015 Posted February 12, 2015 Maybe map a drive to the root of the deepest folder in the tree you can get to that accommodates everything, and retry the operation from there?
Ryno Posted February 12, 2015 Author Posted February 12, 2015 That way works but i was just wondering if there was a quicker way or even a way to copy the whole drive. Its not just one there is hundreds of them!! I have been doing this and also renaming them and it is just taking far to long. Thanks
HC_Netman Posted February 12, 2015 Posted February 12, 2015 I'm pretty sure we used Robocopy to do something similar a few years ago. Can't remember exactly how it works but its free and there are plenty of guides if you Google it and i'm sure someone here will be able to tell you what commands to use...
Arthur Posted February 12, 2015 Posted February 12, 2015 The following PowerShell script will give you a list of all of the long filenames. Just change the path (in red) to the folder you want to check. Get-ChildItem "[color="#FF0000"]X:\Data[/color]" -File -Recurse | Add-Member -MemberType ScriptProperty -Name NameLength -value { $this.name.length } -PassThru -Force | where {$_.NameLength -ge 80 } | Select FullName Source: www.petri.com/powershell-problem-solver-finding-long-file-names.htm
jinnantonnixx Posted February 12, 2015 Posted February 12, 2015 (edited) It's down to a flaw in the way Windows stores the path. (256 bytes) Two common approaches are: 1. Map a drive letter as far into the path as you can, then copy (hence shortening the path string) 2. Use Robocopy and prefix the paths with '\\?\' (without the quotes) which will use 32768 characters to store the path. Edited February 12, 2015 by jinnantonnixx 2
Koldov Posted February 12, 2015 Posted February 12, 2015 This half-term I am looking to move a lot of shares from our old 2008 server to our new 2012R2, so I may well be interested in this soon... What software are you using to do the copy, or is it a drag and drop operation (as I know that has issues with long folder names)? So far I've heard of robocopy (but not great at command line and amount of switches looks daunting), or File Server Migration Toolkit as I'd prefer something inbuilt. Maybe even take the backup from the night before and restore it to the new server although it's an admin/SLT share and I'd hate to muck up the permissions on it! Kol.
DellOughta Posted February 13, 2015 Posted February 13, 2015 Microsoft SyncToy is a good tool to sync /migrate files Download SyncToy 2.1 from Official Microsoft Download Center
Ryno Posted February 14, 2015 Author Posted February 14, 2015 Hi all, Thank you for this information. What I have decided to do is use tree comp to transfer all the files over and then hopefully at the end it will tell me what errors it had and then I should be able to correct them and then copy them over. The drive is actually 2tb and tree comp is reporting it will take 2 days. Thank you again for your help. I will try the other ways when I get the errors.
Arthur Posted February 14, 2015 Posted February 14, 2015 It's down to a flaw in the way Windows stores the path. Isn't it technically to do with the APIs that each Windows program uses? NTFS, Robocopy and most anti-virus/backup applications support 32,768 character file and folder paths, whereas Explorer is still limited to 260 characters probably because Microsoft is too concerned with breaking old or poorly-written 3rd-party Windows applications. NT+ is fully capable of dealing with file names of any size. Win32 on NT can also do this using the \\?\ hack. Almost every filename-related article in MSDN mentions this. However, 99.9% of software out there does this: char filename[MAX_PATH]; and breaks horribly when this is not the case. (Source)
Garacesh Posted February 25, 2015 Posted February 25, 2015 NTFS, Robocopy and most anti-virus/backup applications support 32,768 character file and folder paths, whereas Explorer is still limited to 260 characters probably because Microsoft is too concerned with breaking old or poorly-written 3rd-party Windows applications. See also: Windows 10 It's down to a flaw in the way Windows stores the path. (256 bytes) Two common approaches are: 1. Map a drive letter as far into the path as you can, then copy (hence shortening the path string) 2. Use Robocopy and prefix the paths with '\\?\' (without the quotes) which will use 32768 characters to store the path. Trying to use Robocopy gives me Error 267, directory name is invalid - rather inexperienced though so it might just be me.. Robocopy "\\Path\To\StudentArea\StupidlyLongFileNameBecauseTheStudentDoesn'tKnowHowToUsePunctuationAndWordHasAStupidDefaultFilenamePolicy.docx" "\\Path\To\StudentArea\LessStupidName.docx
jinnantonnixx Posted February 25, 2015 Posted February 25, 2015 Robcopy doesn't work like that. You specify the folders - and only the folders - for the source and destination. If you want specific files or types of files, these are listed after the folders.
Garacesh Posted February 25, 2015 Posted February 25, 2015 Robcopy doesn't work like that. You specify the folders - and only the folders - for the source and destination. If you want specific files or types of files, these are listed after the folders. Oh, right, so how does Robocopy get used to rename a file then? O.o Confus'd
Arthur Posted February 25, 2015 Posted February 25, 2015 so how does Robocopy get used to rename a file then? O.o Confus'd I normally use 7-Zip's File Manager to rename files and folders with long names (if Windows is unable to). Robocopy is typically used just to copy the data from one location to another.
jinnantonnixx Posted February 25, 2015 Posted February 25, 2015 Oh, right, so how does Robocopy get used to rename a file then? O.o Confus'd That's not possible with Robcopy.
Garacesh Posted February 25, 2015 Posted February 25, 2015 That's not possible with Robcopy. My apologies, then. With you mentioning it as an approach and that it can handle longer filenames I assumed it could be utilised to modify the name. I normally use 7-Zip's File Manager to rename files and folders with long names (if Windows is unable to). Robocopy is typically used just to copy the data from one location to another. Tried using 7Zip. No dice.
cpjitservices Posted February 25, 2015 Posted February 25, 2015 (edited) Try DeltaCopy It uses Rsync which is free. DeltaCopy - Rsync for Windows It does sometimes complain about filenames being too long but you can replace the files within in Delta Copy - theres a how to on the net somewhere and it fixes the problem. Its the cygwin files that you replace with the ones on cygwins site and hey presto. http://www.aboutmyip.com/AboutMyXApp/DisplayFAQ.do?fid=12 http://benevolentmachine.blogspot.co.uk/2010/10/eliminating-deltacopys-file-name-too.html Edited February 25, 2015 by cpjitservices
sted Posted February 25, 2015 Posted February 25, 2015 My apologies, then. With you mentioning it as an approach and that it can handle longer filenames I assumed it could be utilised to modify the name. Tried using 7Zip. No dice. no you just use it to move/copy the files somewhere with a shorter path
Garacesh Posted February 25, 2015 Posted February 25, 2015 There is no shorter path. The document name (including .docx extension) is 250 characters long.
sparkeh Posted February 25, 2015 Posted February 25, 2015 Apparently there is a hotfix for this now: A file copy operation fails when files or folders have long paths in Windows Explorer
Garacesh Posted February 25, 2015 Posted February 25, 2015 Apparently there is a hotfix for this now: A file copy operation fails when files or folders have long paths in Windows Explorer No dice. Still can't move or rename the file.
Koldov Posted February 25, 2015 Posted February 25, 2015 (edited) Just delete the file and pretend Windows had an issue with it due its long filename, it got corrupted and it couldn't be backed-up? See how quickly this student's default file naming policy changes? I am personally going to use this technique with a bit of tech-speak (which they won't understand) to force a change in our ridiculously messy and cluttered shared drive (read: dumping ground). Kol. Edit: What about WinRAR or is this the same procedure that you use with 7zip? Edited February 25, 2015 by Koldov 1
jinnantonnixx Posted February 25, 2015 Posted February 25, 2015 Try Total Commander. Maybe it can bypass the limitations of Explorer. Total Commander - home Unicode names almost everywhere, long names (>259 characters), password manager for ftp and plugins, synchronize empty dirs, 64 bit context menu, quick file filter (Ctrl+S)
Garacesh Posted February 25, 2015 Posted February 25, 2015 Just delete the file and pretend Windows had an issue with it due its long filename, it got corrupted and it couldn't be backed-up? See how quickly this student's default file naming policy changes? I am personally going to use this technique with a bit of tech-speak (which they won't understand) to force a change in our ridiculously messy and cluttered shared drive (read: dumping ground). Kol. Edit: What about WinRAR or is this the same procedure that you use with 7zip? Ha! Winrar worked! That's exactly the same process I tried with 7zip but 7zip kept telling me the file couldn't be found (or something to that degree) every time I tried to rename it. Thanks! Didn't want to just delete the file as it's one of our lower-ability kids that has a TA etc. Fairly certain they had no clue it would have caused a problem.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now