DosTips.com

A Forum all about DOS Batch
It is currently 25 Jun 2017 04:35

All times are UTC-06:00




Post new topic  Reply to topic  [ 5 posts ] 
Author Message
PostPosted: 14 Feb 2017 07:55 
Offline

Joined: 17 Mar 2014 08:43
Posts: 15
OK... so I've googled it
The the solutions seem to involved super complex answers

Why is there no easy and straight forward solution?

Why does this problem occur?
I can understand that users shouldn't be allowed to have a file name that is 1m chars long - but then set a limit and don't let the limit be exceeded in the first place

Anyway... whats the best way of solving?

Thanks


Top
   
PostPosted: 14 Feb 2017 12:30 
Offline
Expert

Joined: 22 Jan 2010 18:01
Posts: 2672
Location: Germany
OM3 wrote:
Why is there no easy and straight forward solution?
You should rather ask Microsoft.

OM3 wrote:
Why does this problem occur?
Because there is a different handling on Windows of pathes in Unicode (UTF-16) that support long pathes and ANSI encoded pathes that support only 259 characters. Why? Ask Microsoft.

OM3 wrote:
whats the best way of solving?
Since this forum is about Windows Batch I should suggest ROBOCOPY
http://superuser.com/questions/45697/ho ... lenameOK...
But note that the maximum length of a command line is 8191. Why? Ask Microsoft.

Steffen


Top
   
PostPosted: 14 Feb 2017 12:31 
Offline

Joined: 06 Sep 2013 21:28
Posts: 705
Location: Virginia, United States
Where are you getting these long names from? I can't even create a file with a name+extension that exceeds 200 characters.


Top
   
PostPosted: 14 Feb 2017 14:55 
Offline

Joined: 26 Dec 2013 09:28
Posts: 90
To answer to your question we need to know what are you meaning when you are saying "really long file name".
1. full path is too long. For example, c:\very\long\path-name\with\very-long-file-name could exceed the OS limitation (~8K chars per the object)
2. file name itself is too long. For example, c:\some\short\path\very-very-very-long-file-name.

It is not important how these cases was accomplished. Fro example, under cygwin it is possible. In this case use the same tool or application for deletion this kind of files.

One way - I guess it is true for the case #1 above

Code: Select all
subst x: c:\very\long\path-name\with
del x:\very-long-file-name
subst x: /d


Another way - use short names for deletion
Code: Select all
for %f in ( "c:\very\long\path-name\with\very-long-file-name" ) do @del "%~sf"


Top
   
PostPosted: 15 Feb 2017 08:45 
Offline

Joined: 20 Jan 2016 15:46
Posts: 20
ShadowThief wrote:
Where are you getting these long names from? I can't even create a file with a name+extension that exceeds 200 characters.

I've had a downloading plugin for Firefox create files that Windows itself said were invalid.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 5 posts ] 

All times are UTC-06:00


Who is online

Users browsing this forum: mogodan2008 and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited