How to get LocalPath from Zip Extracted Files Variable?

Hi everyone, I would like to ask about how to get FullName and LocalPath from the Zip Extracted Files Variable and assign to new var string as below.

ZipContents Var: ILocalResource[1] { FileSystemLocalItem { Context=null, CreationDate=[10/31/2023 08:04:00], FullName=“Account.csv”, IconUri=null, ID=“C:\ZipFiles\Account.csv”, IsFolder=false, IsResolved=true, LastModifiedDate=[10/31/2023 08:15:46], LocalPath=“C:\ZipFiles\Account.csv”, Metadata=Dictionary<string, string>(0) { }, MimeType=null } }

@aeklikit

Create two new string variables to store the FullName and LocalPath of the extracted files. Let’s call them fullNameList and localPathList .

Use a For Each loop to iterate through the extractedFiles variable, which should be of type System.IO.FileInfo[] since extracted files are usually represented as FileInfo objects.

Inside the loop, use the “Assign” activity to update the fullNameList and localPathList variables. You can use the FullName and LocalPath properties of the current FileInfo object.

Assign fullNameList = New List(Of String)
Assign localPathList = New List(Of String)

For Each file In extractedFiles
    fullNameList.Add(file.FullName)
    localPathList.Add(file.Directory.FullName)

Assign fullNameString = String.Join(Environment.NewLine, fullNameList)
Assign localPathString = String.Join(Environment.NewLine, localPathList)

Hi @aeklikit

Try this

Extract Files (store in ExtractedFiles)
For Each currentItem in ExtractedFiles (TypeArgument: System.IO.FileInfo)

    Assign FileFullName = Path.GetFileName(currentItem.ToString)
    Assign FileLocalPath = Path.GetFullPath(currentItem.ToString)

    // Use FileFullName and FileLocalPath as needed
End For Each

Path.GetFileName(currentItem.ToString): This will retrieve the file names present in the folder.
Path.GetFullPath(currentItem.ToString): This will retreive the whole path of the files present in the folder.

Hope it helps!!

@Dilli_Reddy

Please let me know about activity for this function, I try to use assign activity but have error as below.

Thank you.


Unzip_Rename.xaml (14.1 KB)

Hi @aeklikit
Check this video

Please let me know variable type for FileFullName and FileLocalPath, I try to assign but have error as below.

GetZipContents.xaml (11.5 KB)

Hi @aeklikit

Change FileFullName and FileLocalPath to the DataType System.String.

Regards,

Sorry for disturbing you again.

After change the DataType to System.String but get the value as below.

I’m not sure whether there was anything I did incorrectly.

@aeklikit

Try using Extractedfile(0).LocalPath

image

it would give you the fullpath of the file in local

if only one can use this…else increase the number or use loop and inside loop use currentItem.LocalPath

Hope this helps

cheers

Hi @aeklikit,

Hope it helps!
ExtractFilename.xaml (10.1 KB)

Thanks!

1 Like

I can get file FullName and LocalPath as your method, It easy and useful.

Thank you so much @Anil_G

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.