Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to extract the files from all subfolders in a directory

i need to extract all qvw log files from a directory and its SUBDIRECTORIES TOO ..

i tried with few commands like



but they are not working....please assist me

1 Solution

Accepted Solutions
prieper
Master II
Master II

Please check the OL-Help for DIRLIST. You will find also a sample-script, which you may modify as first starter:

quote:


// list all QV related files on disk

sub DoDir (Root)
for each Ext in 'qvw', 'qva', 'qvo', 'qvs'
for each File in filelist (Root&' \*.' &Ext)
Load '$(File)' as Name, FileSize( '$(File)' ) as Size, FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
next Dir
end sub
call DoDir ('C:')

unquote


HTH
Peter

View solution in original post

8 Replies
prieper
Master II
Master II

Please check the OL-Help for DIRLIST. You will find also a sample-script, which you may modify as first starter:

quote:


// list all QV related files on disk

sub DoDir (Root)
for each Ext in 'qvw', 'qva', 'qvo', 'qvs'
for each File in filelist (Root&' \*.' &Ext)
Load '$(File)' as Name, FileSize( '$(File)' ) as Size, FileTime( '$(File)' ) as FileTime
autogenerate 1;
next File
next Ext
for each Dir in dirlist (Root&' \*' )
call DoDir (Dir)
next Dir
end sub
call DoDir ('C:')

unquote


HTH
Peter

Not applicable
Author

This script realy works.

I used it to solve one similar problem.

Just replace the extensions list in

for each Ext in 'qvw', 'qva', 'qvo', 'qvs'


and use it Wink

Not applicable
Author

Thanx lots peter Smile ...i will implement the same and return back,if i have further queries..have a great day...

Not applicable
Author

Hi Peter,

in My sheet has a book Mark object having lot of book marks.

when i am selecting bookmark name i need to place the Selected book name into one variable.

how it is possible.....

Please Help me on this...

Many Thanks

vasu.I

prieper
Master II
Master II

I do not see the link to the original thread, suggest to open a new thread.

Am not sure, whether it makes sense: how would you handle a further selection on top of a bookmark?

Alternatively you may show the bookmark-object in your application or show the entire selection.

Peter

Not applicable
Author

Hi Peter Plz find the  following Thread

for Geeting the Selected Bookmark name form book mark object into an variable...  please help me on this..,

Thread

Thanks&Regards

vas.I

Not applicable
Author

Hi Peter,

I have tried your script below, but for some reason it is not moving on to the next sub directory, any idears why?

Lawrence

// list all QV related files on disk

sub DoDir (Root)

for each Ext in 'qvw', 'qva', 'qvo', 'qvs'

for each File in filelist (Root&' \*.' &Ext)

Load '$(File)' as Name, FileSize( '$(File)' ) as Size, FileTime( '$(File)' ) as FileTime

autogenerate 1;

next File

next Ext

for each Dir in dirlist (Root&' \*' )

call DoDir (Dir)

next Dir

end sub

call DoDir ('C:')

Not applicable
Author

Hi Everyone,

It seems that the above code does not work as it should. It cannot move to the next sub directory. I made it successful after modifying the script by removing the preceding space before '\' in (Root&' \*.' &Ext).

Here is the modified code:

sub DoDir (Root)

for each Ext in 'xlsx'

  for each File in filelist (Root&'\*.' &Ext)

  Load '$(File)' as Name,

  FileSize( '$(File)' ) as Size,

  FileTime( '$(File)' ) as FileTime

autogenerate 1;

  next File

next Ext

for each Dir in dirlist (Root&'\*' )

  call DoDir (Dir)

next Dir

end sub

call DoDir ('C:')

cheers!