Sign in to follow this  
Followers 0
jben

Path split question

2 posts in this topic

#1 ·  Posted (edited)

Hey everyone. Just a quick one

I'm trying to split a path. This works fine in the respect that it gets the location of the zip so I can extract it to TEMP2 but the only problem I have is that i'm trying to figure out how I can name the extrated folder...The code below will work fine with my .ini file If I name the folder to the zip that extracts. However I'm trying to work out how I can name the folder the name at the top..

Anyone have any ideas..

_PathSplit($files[$i],$null,$null,$fname,$null);gets the name of the folder at top level
_ZipUnzip($files[$i],@TempDir&"\TEMP2\")

The idea so far is this, but it doesn't name my extracted folder the name the folder comes from..

_PathSplit($files[$i],$fname,$null,$null,$null)

The folder is like this

FOLDER1

..............SUBFOLDER1

...................................ITEM.ZIP

My code above quite happily gets the zip file and will extract it to a folder that the name is taken from the zip file...

So the name of the folder thats extracted would be ITEM....But I want the name to be FOLDER1

Edited by jben

Share this post


Link to post
Share on other sites



IMO, creating a unique folder name would help prevent issues in case the folder already exists. If so, then you may use the _ TempFile() standard UDF to generate a folder path.

#include <File.au3>
$folder_temp = _TempFile(@TempDir, "~", "")
MsgBox(0x40000, Default, $folder_temp)

:D

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0