File Path Name Length

G

Guest

I "own" a 110 GB Directory on one of my employers servers that is
undergoing a migration project to a larger, faster, more powerful
server. My challenge is that many of the current file path names
exceed 255 characters. Is there a technical solution that will
automatically truncate the file path name and assign a numerical
sequence during the renaming ?
 
W

Wesley Vogel

This may be of some interest.

[[Long Filename Finder is the easiest way to find and shorten filenames that
are too long to be backed up to CD-R (or CD-RW).

Many CD-R mastering programs limit the length of the filenames that can be
stored on the CD-R. In some cases, this length is as short as 62 characters.
Your files can easily have names that exceed the limit, especially for
multimedia files such as MP3 that contain artist, album, title, track number
information. Before backing up to CD-R, you must rename all your files so
that none of the filenames exceed the limit. ]]

Long Filenames Finder
http://www.dcsoft.com/products/longff/longff.htm

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
 
G

Guest

Hi Wesley ... thanks for the tip, but this is not the solution that I am
hoping to discover. I'm looking for a way to truncate the file and assign it
a sequential number automatically during the migration process. The time to
rename each file is prohibitive.

Still looking for a "e-solution" gang.

Best Regards

Steve P.



Wesley Vogel said:
This may be of some interest.

[[Long Filename Finder is the easiest way to find and shorten filenames that
are too long to be backed up to CD-R (or CD-RW).

Many CD-R mastering programs limit the length of the filenames that can be
stored on the CD-R. In some cases, this length is as short as 62 characters.
Your files can easily have names that exceed the limit, especially for
multimedia files such as MP3 that contain artist, album, title, track number
information. Before backing up to CD-R, you must rename all your files so
that none of the filenames exceed the limit. ]]

Long Filenames Finder
http://www.dcsoft.com/products/longff/longff.htm

--
Hope this helps. Let us know.

Wes
MS-MVP Windows Shell/User

In
srpender said:
I "own" a 110 GB Directory on one of my employers servers that is
undergoing a migration project to a larger, faster, more powerful
server. My challenge is that many of the current file path names
exceed 255 characters. Is there a technical solution that will
automatically truncate the file path name and assign a numerical
sequence during the renaming ?
 
F

foxidrive

Hi Wesley ... thanks for the tip, but this is not the solution that I am
hoping to discover. I'm looking for a way to truncate the file and assign it
a sequential number automatically during the migration process. The time to
rename each file is prohibitive.

Still looking for a "e-solution" gang.

Best Regards

Steve P.

(Untested) The batch below is designed to create a batch file to rename all
the files with filenames longer than 254 characters (not including
extension) to the leading 245 characters of the filename with - and an
incrementing numeral at the end, plus the extension.

It is also meant to create another batch file to restore the names of the
renamed files. Testing is your responsibility.


@echo off
echo.@echo off>ren-old.bat
echo.@echo off>ren-new.bat
for /f "delims=" %%a in ('dir /a-d /b /s') do call :next "%%a"
goto :EOF
:next
(set flag=)
set "var=%~n1"
if not "%var:~254,1%"=="" set flag=1
if not "%var:~254,1%"=="" set /a c=c+1
if not "%var:~254,1%"=="" set "var=%var:~0,245%-%c%%~x1"
if defined flag >>ren-new.bat echo ren %1 "%var%"
if defined flag >>ren-old.bat echo ren "%~dp1\.\%var%" "%~nx1"
 
S

sali

srpender said:
I "own" a 110 GB Directory on one of my employers servers that is
undergoing a migration project to a larger, faster, more powerful
server. My challenge is that many of the current file path names
exceed 255 characters. Is there a technical solution that will
automatically truncate the file path name and assign a numerical
sequence during the renaming ?

what about short names?
like dir /x
short names are allready unique, and not longer than 8 chars
you may rename files/folders with their short names
look at the for /? command, there is example of using short name modifier.

something like [just as idea, you need a reccursive task]:

for %i in (*.*) ren %i %~si
 
M

Matthias Tacke

foxidrive wrote:
....
It is also meant to create another batch file to restore the names of the
renamed files. Testing is your responsibility.


@echo off
echo.@echo off>ren-old.bat
echo.@echo off>ren-new.bat
for /f "delims=" %%a in ('dir /a-d /b /s') do call :next "%%a"
goto :EOF
:next
(set flag=)
set "var=%~n1"
if not "%var:~254,1%"=="" set flag=1
if not "%var:~254,1%"=="" set /a c=c+1
if not "%var:~254,1%"=="" set "var=%var:~0,245%-%c%%~x1"
if defined flag >>ren-new.bat echo ren %1 "%var%"
if defined flag >>ren-old.bat echo ren "%~dp1\.\%var%" "%~nx1"

What happens if the path part exceeds the limit? you can't
rename the path part.

It may be more useful to climb through the source tree and copy to a sole
number in a flat folder while creating the restore batch and restoring
later on.

HTH
Matthias
 
F

foxidrive

foxidrive wrote:
...

What happens if the path part exceeds the limit?

Which limit?
you can't rename the path part.

On a hard drive, if the paths are legitimate, it's only an issue when it
exceeds the command line length and XP has an 8 kilobyte limit.

Or have I misunderstood Matthias?
 
M

Matthias Tacke

foxidrive said:
Which limit?

If I understand the OP right, the transport from old to new server is
sensitive to a path&filename length of 255 chars.

If the path part of the file name exceeds 255 chars the rename works but
the remaining path and name will still exceed the 255 char limitation the
OP has (for whatever reason)
On a hard drive, if the paths are legitimate, it's only an issue when it
exceeds the command line length and XP has an 8 kilobyte limit.

Or have I misunderstood Matthias?

I know, the command line length is no problem but if the folder structure
doesn't survive the transport, the ren of the file name won't help
reconstruct the folder structure.

Maybe some more details from the OP would help to clarify the way the data
is moved to the new server and where the limitation to 255 chars is based.

Greetings
Matthias
 
T

Todd Vargo

srpender said:
Hi Wesley ... thanks for the tip, but this is not the solution that I am
hoping to discover. I'm looking for a way to truncate the file and assign it
a sequential number automatically during the migration process. The time to
rename each file is prohibitive.

In your first post you said you want to truncate the "file path names". Now
you say you want to "truncate the file". Which is it?

Unfortunately, we don't have enough details about the problem to go on. Is
the filename length preventing from copying the files or is the fully
qualified name causing the problem? How are you copying the files? Why do
you want to assign sequential numbers? Do you need to rename the files back
to original names? Come on, help us out here.
 
D

David Trimboli

srpender said:
I "own" a 110 GB Directory on one of my employers servers that is
undergoing a migration project to a larger, faster, more powerful
server. My challenge is that many of the current file path names
exceed 255 characters. Is there a technical solution that will
automatically truncate the file path name and assign a numerical
sequence during the renaming ?

As an alternative, perhaps you could use SUBST to assign a drive letter
to a deep path, and copy files through the new drive letter instead of
the deep path.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top