Copy Files with long file names

  • Thread starter Thread starter bala
  • Start date Start date
Status
Not open for further replies.
B

bala

Hi,

I am using CopyFile (Scripting.FileSystemObject) to copy file from one
location to another. The naming convention followed makes the file
names (+ the path) lenghty and the total characters can exceed 260
characters.

I would appreciate if you can let me know if there is any solution to
bypass max limit (Filename + Path) of 260 characters.

The copying of file from one location to another happens on the click
of a button in MS Access Forms.

Thanks in Advance.

Regards
Bala
 
Access Version : Access 2003

The files (can be any type of files like .xls, .doc, .pdf etc..) is
copied from local Computer to network drive.
 
bala said:
Hi,

I am using CopyFile (Scripting.FileSystemObject) to copy file from one
location to another. The naming convention followed makes the file
names (+ the path) lenghty and the total characters can exceed 260
characters.

I would appreciate if you can let me know if there is any solution to
bypass max limit (Filename + Path) of 260 characters.

The copying of file from one location to another happens on the click
of a button in MS Access Forms.

Thanks in Advance.

Regards
Bala

Well you can use short file names instead:

http://www.smccall.demon.co.uk/Strings.htm#ShortPath
 
Can't you get the short file name at runtime to pass to your CopyFile
procedure whilst keeping the full name stored/displayed?

Jon







There lies the problem, the clients wants the naming convention to be
followed and the naming convention does creates long names. Any work
around?- Hide quoted text -

- Show quoted text -

That is a good suggestion but the client wants the files to be named
according to the naming convention (translated : long name). According
to them they want to identify the nature of the file by glancing at
the name.

What I also tried is using the short dummy name to copy file using
CopyFile and then tried to rename it with the long name but it didn't
work out.

I have search web and couldn't find any solution for it as Windows XP
as a max limit of 260 characters when NTFS file system can handle upto
32,000 char.

To be honest I think the bottom line is as per Stuart and your
suggestion the File Name (inclusive of the Path) have to be restricted
to less than 240 chars (to be on a safer side). A file name (including
Path) with lenght of 253 Chars also created problem.

If there is any work around well it would be nice if not have to start
the long never ending process of convincing the Client.
 
Where are you copying the file to; network or C: drive?

What is so long; the filename or the folder name?  If folder name, you
can map a drive letter
   Set WshNetwork = CreateObject("WScript.Network")
   WshNetwork.MapNetworkDrive "L:", "\\mydrive\share"

Then you'd copy the file to drive L:

If your filename is 250 chars+, wow!- Hide quoted text -

- Show quoted text -

I am copying the file to network drive and yes it is 250 Chars +. That
is problem. Sometimes there maybe one subfolder or 2 at the max. The
name of the file (following the naming convention) tends to be
long.That is the killer here.
 
Where are you copying the file to; network or C: drive?

What is so long; the filename or the folder name? If folder name, you
can map a drive letter
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "L:", "\\mydrive\share"

Then you'd copy the file to drive L:

If your filename is 250 chars+, wow!- Hide quoted text -

- Show quoted text -
I am copying the file to network drive and yes it is 250 Chars +. That
is problem. Sometimes there maybe one subfolder or 2 at the max. The
name of the file (following the naming convention) tends to be
long.That is the killer here.

Well if your client insists on sticking with FAT32 file system then the only
(sensible) solution is to redesign the naming convention. They've
overstepped the mark, unfortunately.
 
Well if your client insists on sticking with FAT32 file system then the only
(sensible) solution is to redesign the naming convention. They've
overstepped the mark, unfortunately.- Hide quoted text -

- Show quoted text -

Sorry for the confusion, what the client as is NTFS File System even
then the limitation (Max Lenght of 260) comes into play because of
Windows XP.
 
Well if your client insists on sticking with FAT32 file system then the
only
(sensible) solution is to redesign the naming convention. They've
overstepped the mark, unfortunately.- Hide quoted text -

- Show quoted text -
Sorry for the confusion, what the client as is NTFS File System even
then the limitation (Max Lenght of 260) comes into play because of
Windows XP.

OIC. Well they've still overstepped. IMO they need to see if there's a way
to abbreviate at least part(s) of the name while leaving it still
recognisable. After all, as Salad says, it can hardly be 'glanced' as it
stands.
 
OIC. Well they've still overstepped. IMO they need to see if there's a way
to abbreviate at least part(s) of the name while leaving it still
recognisable. After all, as Salad says, it can hardly be 'glanced' as it
stands.- Hide quoted text -

- Show quoted text -

Yeah you are right. :o). I have started the long process of convincing
the Client to use short name for files and have both the short name
and long name stored in a table for mapping purpose. I can seethe
Quality Control and Audit team creating a ruckus.

Thanks Stuart. Thanks to Jon and Salad too.

Note: if at all there is a work around found (anytime down the line) I
would definitely appreciate if the solution is posted here.
 
Salad said:
I sometimes wish there were a property, maybe called Purpose, where a
filename, when saved, could have a memo attached to it. When one does
a dir or via Explorer one sees that property field in the list as
well. MS could have done that years ago.
...

On Win XP using Windows Explorer I have added either the "Title" or
"Comments" columns to the detail view and populated that property
manually. I don't know how to display that data using Dir, but it sure
is handy in explorer.

Are those properties available through the scripting filesystem object?
[Summary tab on file properties dialog sheet.]

Seems like that might be an alternative to investigate.
 
bala said "According to them they want to identify the nature of the
file by glancing at the name." A filename of 260+chars is not glancing,
that's reading a sentence per filename.

No, that's a paragraph, not a sentence.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
Clif McIrvin said:
Salad said:
I sometimes wish there were a property, maybe called Purpose, where a
filename, when saved, could have a memo attached to it. When one does a
dir or via Explorer one sees that property field in the list as well. MS
could have done that years ago.
...

On Win XP using Windows Explorer I have added either the "Title" or
"Comments" columns to the detail view and populated that property
manually. I don't know how to display that data using Dir, but it sure is
handy in explorer.

Are those properties available through the scripting filesystem object?
[Summary tab on file properties dialog sheet.]

Yes they are. Good thinking. I'd forgotten Custom file properties.
Definitely worth investigating.

To bala: Take a look at this page for clues:

http://www.activexperts.com/activmonitor/windowsmanagement/scripts/storage/filesystems/#CCDP.htm
 
Salad said:
Stuart said:
I sometimes wish there were a property, maybe called Purpose, where
a filename, when saved, could have a memo attached to it. When one
does a dir or via Explorer one sees that property field in the list
as well. MS could have done that years ago.
...

On Win XP using Windows Explorer I have added either the "Title" or
"Comments" columns to the detail view and populated that property
manually. I don't know how to display that data using Dir, but it
sure is handy in explorer.

Are those properties available through the scripting filesystem
object? [Summary tab on file properties dialog sheet.]

Yes they are. Good thinking. I'd forgotten Custom file properties.
Definitely worth investigating.

To bala: Take a look at this page for clues:

http://www.activexperts.com/activmonitor/windowsmanagement/scripts/storage/filesystems/#CCDP.htm

Very cool. I notice that if I added Category or Description to
display in the folder it is specific to the folder, not all folders.
Is each folder's property set individually or can it be set globally?
Would you need to inform each user to tag the folder/folders for each
one they wanted to view? For example, UserA sees the property and
UserB doesn't unless they did it?


I think you are looking for a response from someone with more experience
than I.

I'm pretty certain the Folder Options settings are per user. At a
guess, this information is somewhere in the registry, so you should be
able to control it from code (policy, maybe?). As to individual folders,
the View tab of the Folder Options dialog (Tools | Folder Options from
explorer, also available in Control Panel) has a button to apply the
current view settings to every folder.
 
Well they've still overstepped. IMO they need to see if there's a
way to abbreviate at least part(s) of the name while leaving it
still recognisable. After all, as Salad says, it can hardly be
'glanced' as it stands.

Better yet, map a share closer to the destination, instead of in the
root of the drive.
 
I sometimes wish there were a property, maybe called Purpose,
where a filename, when saved, could have a memo attached to it.
When one does a dir or via Explorer one sees that property field
in the list as well. MS could have done that years ago.

With Office files, that already exists.
 
bala said "According to them they want to identify the nature of
the file by glancing at the name." A filename of 260+chars is not
glancing, that's reading a sentence per filename. If one wants to
glance, your suggestion of redesigning the naming convention makes
sense. Or store the long stuff to a memo field in a table and copy
to a short name.

I miss being able to vote up an answer when not reading
StackOverflow.com. This would definitely get a +1 vote from me.
 
What is so long; the filename or the folder name? If folder name, you
can map a drive letter
Set WshNetwork = CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive "L:", "\\mydrive\share"

Then you'd copy the file to drive L:

I doubt very much that you can get around this problem by assiing a
drive letter to a share. I stronglyI suspect in Windows of any sort
the length of the server name, share name, folders and file name is a
maximum of 260.

The drive letter plus the file name is a lot shorter on your system
but the file server won't allow you to use that file name.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages - http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
updated see http://www.autofeupdater.com/
 
I doubt very much that you can get around this problem by assiing a
drive letter to a share.  I stronglyI suspect in Windows of any sort
the length of the server name, share name, folders and file name is a
maximum of 260.    

The drive letter plus the file name is a lot shorter on your system
but the file server won't allow you to use that file name.

Tony
--
Tony Toews, Microsoft Access MVP
Tony's Main MS Access pages -http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog -http://msmvps.com/blogs/access/
For a convenient utility to keep your users FEs and other files
  updated seehttp://www.autofeupdater.com/

I will definitely take a look at the custom file property.

Stuart I definitely will look into it.

Also I did a simple test. I manually renamed an existing Excel file
(contain Data) with a long name (253 char lenght). The long name was
accepted but when I tried to open Excel file it gave me a error that
the file name is too long. When I reverted back to the original short
name or any short name it opened fine and displayed the Data.

Since Windows XP (and I believe Windows 7 too) handles max lenght of
260 I believe even if we successfully rename and copy any files with
long name the behaviour of the copied file can be unpredictable.

Thanks again.
 
Status
Not open for further replies.
Back
Top