Jump to content

Recommended Posts

Posted (edited)

Hi all,

I'm in need of a solution coping data, recursively, which pathlength exceeds the max char. length of 260.

According to MS Technet all copy commands depend on the same .dll in which just 2Mb is reserved causing the name length limitations.

Yes I'm sure the limitation is not in the file system. :)

Yes, there are util's like mcopy, xxcopy, robocopy and many more. but none of them are able to copy files beyond (thanks kip)

How come NTBACKUP has no problem and why do other backup utils often get struck by long path names.

My current workaround is: use subst

But in case of error, say a flaw in Windows :) , the system believes the subst drive is a native drive and can't be de-subst unless one reboots the system...

Edited by 2TMax

Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

Posted

.... can't be de-subst unless one reboots the system...

Really??? So you're saying SUBST drive1: /D doesn't work?? You can see this kind of information for yourself by typing "<command> /?" at the command prompt.

SUBST

--------------------------------

Associates a path with a drive letter.

SUBST [drive1: [drive2:]path]

SUBST drive1: /D

drive1: Specifies a virtual drive to which you want to assign a path.

[drive2:]path Specifies a physical drive and path you want to assign to

a virtual drive.

/D Deletes a substituted (virtual) drive.

Type SUBST with no parameters to display a list of current virtual drives.

Posted

Some ideas mentioned here at Microsoft.

Unfortunately it also mentions the limitation of some Microsoft programs.

Many Windows programs expect the maximum path length to be shorter than 255 characters. Therefore, these programs only allocate enough internal storage to handle these typical paths. NTFS does not have this limit and it can hold much longer paths.

NTFS from Wiki

...the file system supports paths up to about 32,000 Unicode characters with each path component (directory or filename) up to 255 characters long,...

Subst seems like a good solution depending on your need. AutoIt probably uses the same DLL so you may same results with FileCopy() and similar. If you copying a particular folder then a relative address from the script may help (And do look at using FileChangeDir() to change working directory for shorter path addressing).

:)

Posted (edited)

Some ideas mentioned here at Microsoft.

Unfortunately it also mentions the limitation of some Microsoft programs.

NTFS from Wiki

Subst seems like a good solution depending on your need. AutoIt probably uses the same DLL so you may same results with FileCopy() and similar. If you copying a particular folder then a relative address from the script may help (And do look at using FileChangeDir() to change working directory for shorter path addressing).

:)

Thanks for youre interest :)

Unfortunately I doesn't matter using absolute or relative paths. It's the total pathlength that counts including driveletter and separators... Guess it is part of the used dll

A SUBST /D works most of the time but at random times it doesn't.

by the way, the subst can't handle UNC paths so I have to combine it with an PUSHD command.

Edited by 2TMax

Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

Posted (edited)

Using FileChangeDir() may allow to get halfway down the path and then you could use a relative path from the new working directory to the end of the path. By using a relative path, I do refer to not using macros like @ScriptDir or @WorkingDir to create a absolute path from a relative path witch will be too big to handle.

Another idea is perhaps using FileCreateNTFSLink() to create a junction point halfway to the desired location and access the files from the created junction point. If unaware what a junction does, consider it like as making a worm hole to shorten the path.

Rough example

; x:\folder1\folder2\folder3\folder4
DirCreate('x:\f1')
FileCreateNTFSLink('x:\folder1\folder2', 'x:\f1')
DirCreate('c:\here')
FileCopy('x:\f1\folder3\folder4\*.*', 'c:\here')

:)

Edited by MHz
Posted

Using FileChangeDir() may allow to get halfway down the path and then you could use a relative path from the new working directory to the end of the path. By using a relative path, I do refer to not using macros like @ScriptDir or @WorkingDir to create a absolute path from a relative path witch will be too big to handle.

Another idea is perhaps using FileCreateNTFSLink() to create a junction point halfway to the desired location and access the files from the created junction point. If unaware what a junction does, consider it like as making a worm hole to shorten the path.

Rough example

; x:\folder1\folder2\folder3\folder4
DirCreate('x:\f1')
FileCreateNTFSLink('x:\folder1\folder2', 'x:\f1')
DirCreate('c:\here')
FileCopy('x:\f1\folder3\folder4\*.*', 'c:\here')

:)

Thanks MHz!

This might do the trick! :)

I've never worked with links before in NT and wonder if it'll be the same as in OpenVMS or UNIX.

I'm going to try it right away

Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

Posted

Thanks kip, now I remember. Still keep forgetting if it's which or witch. :P

I've done some testing with the FileCreateNTFSLink

Unfortunately still no solution. :)

@ FlexHEX I found following explanation:

Flex HEX

Because all the links must refer to the same MFT entry, you cannot create a hard link on a different drive. Another limitation is that only files can be hard-linked, not directories (however soft links to directories are allowed).

:) Although the manual says: FileCreateNTFSLink "Creates an NTFS hardlink to a file or a directory"

I'm not sure if it makes a softlink in case a folder is given.

Perhaps I would need a function like: FolderCreateNTFSLink that could make a softlink.

Well, I keep trying.

At the AutoIT man. I followed the NTFSLink

I might be able to manage the link with the explorer.

All 2 T best!

:P

Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

Posted (edited)

Thanks kip, now I remember. Still keep forgetting if it's which or witch. :P

I've done some testing with the FileCreateNTFSLink

Unfortunately still no solution. :)

@ FlexHEX I found following explanation:

:) Although the manual says: FileCreateNTFSLink "Creates an NTFS hardlink to a file or a directory"

I'm not sure if it makes a softlink in case a folder is given.

Perhaps I would need a function like: FolderCreateNTFSLink that could make a softlink.

Well, I keep trying.

At the AutoIT man. I followed the NTFSLink

I might be able to manage the link with the explorer.

All 2 T best!

:P

Windows calls the SoftLinks mentioned as Junctions.

Try this example. The flag is needed it seems.

DirCreate(@DesktopDir & '\folder here')
FileCreateNTFSLink(@TempDir & '\', @DesktopDir & '\folder here\', 1)

If you use a command prompt dir cmd on the @DesktopDir directory, you may see that it is marked not as a directory but as a junction. Within the "folder here" folder, I can see the files that exist in the @TempDir folder.

:(

Edit:

I also tested with creating a junction with a target folder on another drive and that works fine as well. You can also mount a drive to a junction in Windows.

Edited by MHz
Posted (edited)

Thanks MHz!

This is it!

I've done some testing myself and indeed, the pathlength can be extended to another 255 char.

I could even create a junction over different drives, aslong it's on a local device.

:) Eh.. still one obstacle to take

The Junctions trick didn't work on UNC's...

Guess I'll need an RPC to the host to do make a junction.

Is there a native AutoIT function to achieve this?

the long path

[/code]
D:\Max\begin\of a\verry\long ----\---- path\name\which contain\strange\nill\characters\like $ %\Yes Percentage % sign\and & ampersand\witch some like ! exclamation\and some extra\are often\nasty path names to process\if these are folder by folde
[u][b]Junction named tier joined @ nill[/b][/u]
D:Maxbeginof averrylong -------- pathnamewhich containstrangenill
[u][b]rest of long path[/b][/u]
C:Maxtiercharacterslike $ %Yes Percentage % signand & ampersandwitch some like ! exclamationand some extraare oftennasty path names to processif these are folder by foldesome default foldernamingNew Folder 2New Folder 3



			
				


	Edited  by 2TMax
	
	

			
		

Sorry for my poor English, I'm just a bloody forainer from the flat country called Nederland.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...