How can I use actxserver​('Shell.Ap​plication'​) to list folders and files in a certain path?

5 Ansichten (letzte 30 Tage)
Hi all,
I have to explore some folders and subfolders and then read some files for certain paths. The problem is that these paths are URL (I have to work on SVN Repositories with URL). I tried to usa automatic SVN command but this doesn't give me the possibility to read file in matlab (for example with fopen or xlsread functions). Now I am trying to use actxserver('Shell.Application') because I found an example in excel macro and it is possible to explore folders and read files giving only the URL:
[. . .]
Dim Range1 As Range
Dim c As Range
Dim Shell As Object
Set Shell = CreateObject("Shell.Application")
Application.DisplayAlerts = False
Sheets("Elenchi_Base").Select
Set Cell = Range("B2")
Folder = 'https://YYY-repo.XXX.com/sandbox/SoftwareFactory/C_IPC/B_SW_Modules'
With CreateObject("Shell.Application")
Set SubFolders = .Namespace(Folder).Items
SubFolders.Filter 32, "*"
End With
If SubFolders.Count = 0 Then
MsgBox "There are No Subfolders in this Directory."
Exit Sub
End If
ReDim vArray(1 To SubFolders.Count, 1 To 1)
For n = 0 To SubFolders.Count - 1
vArray(n + 1, 1) = SubFolders.Item(n).Name
Next n
[. . .]
With this code it is possible to count items in the folders and then it is possible to open these items. I know that it is VB coding. I would like to make something like that in MATLAB. I have to access in a folder and subfolder starting from an URL (working in VPN) and then read the files (using fopen or xlsread).
I tried in Matlab:
objShell = actxserver('Shell.Application');
DestinationFolder = URL;
objFolder = objShell.NameSpace(DestinationFolder);
nFol = objFolder.Item;
but I received this error:
Undefined function 'Item' for input arguments of type
'Interface.Microsoft_Shell_Controls_And_Automation_Folder3'.
Could someone help me to write this code (from VB) in Matab coding?
I hope someone please provide me a clue on how can I address this issue!
Thanks in advance!!

Antworten (0)

Kategorien

Mehr zu Environment and Settings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by