Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 22nd, 2006, 03:23 AM
ssimons ssimons is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 4 ssimons User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 26 sec
Reputation Power: 0
Getting filename out of a full path

Hi Guys,

I'm using a vbs script for postprocessing image files.
The application is use for opening the images call's a vbs file with "filename" as a parameter.

Now the parameter "filename" contains the FULL path to the file. Since i need only the filename for some puposes is use a function to strip the filename out of the full path:

Code:
Function GetFileName(Path)
		Path = Replace(Path, "/", "\")
		If (Len(Path) > 0) AND (InStrRev(Path, "\") <> Len(Path)) Then
			GetFileName = Right(Path, (InStrRev(Path, "\")))
		Else
			Exit Function
		End If


if i have this path: d:\test files\SS_9__IMG12535.jpg
the function will translate this into: 2535.jpg

Can anyone help me with this?

Thx!

Reply With Quote
  #2  
Old March 22nd, 2006, 03:26 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
Hi,
try using the split function
Code:
Function GetFileName(Path)
		Path = Replace(Path, "/", "\")
		
		tempPath = split(Path, "\")
		If Len(tempPath(uBound(tempPath))) > 0  Then
			GetFileName = tempPath(uBound(tempPath))
		Else
			Exit Function
		End If

hope this helps
__________________
Look! Its a ShemZilla



Reply With Quote
  #3  
Old March 22nd, 2006, 03:28 AM
ssimons ssimons is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2006
Posts: 4 ssimons User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 26 sec
Reputation Power: 0
THX M8!

This seems work fine for me!

Reply With Quote
  #4  
Old March 22nd, 2006, 03:33 AM
nofriends's Avatar
nofriends nofriends is offline
Senior Water Wizard
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Aug 2004
Location: Cape Town, RSA
Posts: 10,186 nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)nofriends User rank is Brigadier General (60000 - 70000 Reputation Level)  Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1Folding Points: 107805 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 2 Weeks 2 Days 7 h 36 m 24 sec
Reputation Power: 699
no problem, glad its working

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Getting filename out of a full path


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT