Getting Long File Path from short Path / File Name 
Author Message
 Getting Long File Path from short Path / File Name

How would I be able to get the Long Path Name from a Short Path Name (which
typically has a '~' as a part of the file name.

I have a DBF file (created by another program ) which has a field called
'directory' within which is stored the Short Path / file name eg:

                                                c:\abcde\fghikl~1.jpg

I have noticed that in my program, VFP will totally ignore any reference to
file names with the '~' in it, and so in my case will not show these
pictures. References to files without the '~' works just fine.

Any advice?

Thanks a lot in advance!

Don Bovell



Mon, 17 Mar 2003 10:17:43 GMT
 Getting Long File Path from short Path / File Name

Hope this helps!

1- FoxPro does not have any problems using the tilde '~' character in
file names. I use it to create temp files as a means to distinguish
them from production files.

Example : ~0026400.TMP

2- If you are looking to replace the current entries in your table with
long file names consider using a good old DOS command to accomplish
this.

Eample :

DIR > THISDIR.TXT

-OR-

DIR > C:\TEMP\THISDIR.TXT

-OR, If running from within a FoxPro program-

!DIR > C:\TEMP\THISDIR.TXT

This creates a text file containing the short file name along with the
long file. You'll will need to programmatically parse this text file to
extract the long file name.

3-If the original DBF was created by a FoxPro program take advantage of
its FULLPATH() and ADIR() functions. Or, use combo or list boxes
populated by file names, using FULLPATH(). There are a number of ways
to do this.

Example, listing files to screen, returning fullpath and long file
names:

num=ADIR(myArray,'*.jpg')

IF num=0
   MESSAGEBOX('No Files Matched')
ELSE
   FOR i = 1 TO num
     ? FULLPATH(myArray[i,1])
   ENDFOR
ENDIF

Good Luck!
Dan Borden

Sent via Deja.com http://www.deja.com/
Before you buy.



Mon, 17 Mar 2003 03:00:00 GMT
 Getting Long File Path from short Path / File Name
How about this:

=adir(test, "c:\myprog~1.exe")
m.lcLongFilename = test(1)

Quote:
>Subject: Getting Long File Path from short Path / File Name

>Date: 9/27/2000 7:17 PM Pacific Daylight Time

>How would I be able to get the Long Path Name from a Short Path Name (which
>typically has a '~' as a part of the file name.

>I have a DBF file (created by another program ) which has a field called
>'directory' within which is stored the Short Path / file name eg:

>                                                c:\abcde\fghikl~1.jpg

Mike


Mon, 17 Mar 2003 03:00:00 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Print out Databases File Path and Name

2. How to get the file name of a path

3. Storing images/files - path name format?

4. Image file path names from script?

5. VFP3 - Invalid path of file name

6. store a file or file path

7. File Paths for Program and Data Files

8. Changing path to /tmp/.s.PGSQL.5432 file and the .lock file

9. Renaming file paths in ddf-files

10. Getting Member path from unique name

11. Storing long path names


 
Powered by phpBB® Forum Software