comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Logical links cause EXPAND_PATH() to hang
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Logical links cause EXPAND_PATH() to hang [message #93101 is a reply to message #93095] Wed, 27 April 2016 20:59 Go to previous message
zacharyanorman is currently offline  zacharyanorman
Messages: 17
Registered: July 2015
Junior Member
I would contact technical support at support@harris.com to see if they can reproduce this problem. Otherwise, you can always recursively search each directory for files and only expand your path with folders.

Here is a function that will recursively find your subdirectories for you (I was curious how this would be done). It might take a few seconds depending on how many subfolders you have and I'm not sure if symbolic links will cause problems or not. Worked for me to recursively search my entire Dropbox folder which contains 998 folders total:


function expand_path_better, dir
compile_opt idl2

;change directories to the first directory
cd, dir, CURRENT = first_dir

dirs = list()
;find the directories
directories = file_search(/TEST_DIRECTORY, COUNT=ndirectories)

;check if we have no directories
if (ndirectories eq 0) then begin
print, 'No directories found, returning!'
return, ''
endif

;remember all of the subdirectories
not_searched = list()
found = list()
for i=0, ndirectories-1 do begin
not_searched.add, dir + path_sep() + directories[i]
found.add, dir + path_sep() + directories[i]
endfor

;recursivey check for new directories by searching the directories that
;we haven't searched
;after we search the directory, forget it and only remember
;the directories that we ahve found
while (n_elements(not_searched) gt 0) do begin
cd, not_searched[0]
;search for subdirectories
subdirs = file_search(/TEST_DIRECTORY, COUNT=ndirectories)
if (ndirectories gt 0) then begin
for i=0, ndirectories-1 do begin
not_searched.add, not_searched[0] + path_sep() + subdirs[i]
found.add, not_searched[0] + path_sep() + subdirs[i]
endfor
endif

;remove not_searched directory from the list
not_searched.remove, 0
endwhile

;convert list to array
found = found.toarray()

;join strings with the path separator for your OS (i.e. ':' or ';')
found = strjoin(found, path_sep(/search_path))

;return to first directory
cd, first_dir

;return the list
return, found
end
[Message index]
 
Read Message
Read Message
Previous Topic: Stop a hanging execution
Next Topic: contour plot irregular data within a polygon

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:11:56 PDT 2025

Total time taken to generate the page: 0.00398 seconds