Copy Files with long file names

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
 
B

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.
 
S

Stuart McCall

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
 
B

bala

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.
 
S

Salad

bala said:
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!
 
B

bala

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.
 
S

Stuart McCall

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.
 
B

bala

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.
 
S

Salad

Stuart said:
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.
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.
 
S

Stuart McCall

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.
 
B

bala

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. :eek:). 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.
 
S

Salad

bala said:
Yeah you are right. :eek:). 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.

I think trying to overcome the limitations of an OS will be futile. I
would consider bringing in a network guy with you to the big boys that
can offer suggestions like "Are you f'ing crazy?"

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.

This is something that you can test. Maybe try to do a low level
Create() and write/create your own Copy routine...IOW read the file from
the C: drive and write to the network drive. But if it is your local
drive that accepts really long names and the server doesn't that won't help.

Maybe you can convince the company to buy brand new computers and
servers throughout that can accept the new really long file names. It
might cost many thousands of dollars but they will get what they desire.
 
C

Clif McIrvin

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.
 
T

Tony Toews

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/
 
S

Stuart McCall

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
 
S

Salad

Stuart 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

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?
 
C

Clif McIrvin

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.
 
D

David-W-Fenton

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.
 

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