469,613 Members | 1,208 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,613 developers. It's quick & easy.

Strip File Name & Folder Name from path.....

Hi,

I'm using the FileOpenDialog API that everyone has told me about which
is posted everywhere on this forum.....works like a dream. When I
select a file I get the full path such as :

hghghg/hgjhgh/ghfgg/gfgf/product76-x3/image1.jpg

What I require is to place 'product76-x3' in one variable and
image1.jpg in a second, in order for me to create a new string URL.

I'm not quite sure how to use the trim function to retrieve both ?

Thanks

David Gordon

Nov 13 '05 #1
1 8473
Assuming that you're running this on the same machine where the files exist,
Dir("hghghg/hgjhgh/ghfgg/gfgf/product76-x3/image1.jpg") will return only the
file name (image1.jpg). Getting product76-x3 is a bit more problematic.

Knowing the file name, you can remove it from the string using
Left(FullPath, Len(FullPath) - Len(FileName)-1). (The -1 is necessary to
remove the slash before the file name). You could then use the InStrRev
function to find out where the last slash is (the one before product76-x3)
and use the Mid function to retrieve the folder name.

If you're not running this on the same machine where the files exist, you
can use InStrRev to get the file name as well.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

<da*********@scene-double.co.uk> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Hi,

I'm using the FileOpenDialog API that everyone has told me about which
is posted everywhere on this forum.....works like a dream. When I
select a file I get the full path such as :

hghghg/hgjhgh/ghfgg/gfgf/product76-x3/image1.jpg

What I require is to place 'product76-x3' in one variable and
image1.jpg in a second, in order for me to create a new string URL.

I'm not quite sure how to use the trim function to retrieve both ?

Thanks

David Gordon

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

15 posts views Thread by TaeKyon | last post: by
1 post views Thread by BW | last post: by
1 post views Thread by KevinGPO | last post: by
2 posts views Thread by ImageAnalyst | last post: by
4 posts views Thread by Poppy | last post: by
reply views Thread by devrayhaan | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.