Jump to content
UBot Underground

Extract filename only from an absolute path


Recommended Posts

Here is the regex code to extract the filename from full path.

 

extract filename.ubot

 

I got this idea based on franks code here. So thank him for sharing this code. This started a whole lot of ideas.

 

(?!\\).*?(?=\\) will search everything behind \

then replace every \ with nothing. This will leave the filename only...

 

This could be useful for some.

  • Like 3
Link to post
Share on other sites

I am not sure of the goal you guys have, or from where you are retrieving file names, but I just wanted make sure you knew the $get files command retrieves files with and without paths.

 

John

Link to post
Share on other sites

I am not sure of the goal you guys have, or from where you are retrieving file names, but I just wanted make sure you knew the $get files command retrieves files with and without paths.

 

John

Yes John we are aware of that.. My main goal is to get the variable of uiopenfile filename only and save the file at the end of the bot with additional words in the filename or to save it on other location with the same filename..

 

For example:

 

Original

filename.txt

 

Modified

filename-keywords.txt

filename-url.txt

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...