Jump to content

Recommended Posts

Posted

Hi there,

is it possible to extract just the filename and extension from a full file path (including the file itself)?

If so, how is this done?

Thanks in advance Posted Image

Posted

Yes, _Pathsplit does what you need: "Splits a path into the drive, directory, file name and file extension parts"

For the exact syntax please see the help file.

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

Or use the _PathSplit

#include <file.au3>

Dim $Path = "C:\Folder\SubFolder\File.ext"
Dim $szDrive, $szDir, $szFName, $szExt

_PathSplit($Path, $szDrive, $szDir, $szFName, $szExt)

MsgBox(0, "Filename", $szFName & $szExt )

A-Jay

Rule #1: Always do a backup         Rule #2: Always do a backup (backup of rule #1)

Posted

Thank you Water, Melba, Mobius and Ajag for summing up all these solutions to choose from, much appreciated. :mellow:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...