Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Directory tool can't read subdirectories with long file paths

roe_r
7 - Meteor

I'm using the Directory tool to read in file names but it's having issues with long file paths.  Does anyone have any workarounds for this or is this just a known issue with the Directory tool?  

 

The error is:

 

 

Warning: Directory (2): Invalid Directory "C:\Users\long path here\*.*": The system cannot find the path specified. (3)

 

 

 

I know there is a workaround in windows to allow this ( See this thread ), which I have done and windows doesn't have trouble with the file, but the directory tool still has issues with the location.

 

The location is in a dropbox folder, just in case that matters.

5 REPLIES 5
jamielaird
14 - Magnetar

Hi @roe_r 

 

I'm not sure the file path length is the issue. I just tested with an arbitrarily long file path and Directory worked fine. Are you sure it's not something else?

 

Yes I did create all these foldersYes I did create all these foldersWorks fine..Works fine..

jamielaird
14 - Magnetar

Scratch that, I just read your message properly and the issue is not the file path length but one of the folder names. Tested and indeed you are right that causes borking.

 

Screenshot 2019-05-15 at 15.52.05.pngScreenshot 2019-05-15 at 15.52.15.png

jamielaird
14 - Magnetar

Hi @roe_r 

 

I think I've come up with a viable solution, but it's a bit of a hack.

 

What you'll need to do is leverage the Run Command tool to write out something like the following:

 

 

cd "C:\Users\home\Desktop\parent folder\longfoldername" & dir > "C:\Users\home\Desktop\parent folder\dir.txt

 

 

This will create a file named dir.txt listing the contents of the directory in the parent folder of the long folder. You can then read this in via an Input tool and parse it in the usual way.

 

The dir.txt file will look something like this (looks short as in this case I only had one dummy file in there):

 

 

 Volume in drive C has no label.
 Volume Serial Number is 4E24-CEDF

 Directory of C:\Users\home\Desktop\untitled folder\thisisalongfoldernamethisisalongfoldernamethisisalongfoldernamethisisalongfoldernamethisisalongfoldernamethisisalongfoldername

05/15/2019  04:11 PM    <DIR>          .
05/15/2019  04:11 PM    <DIR>          ..
05/15/2019  04:10 PM                 0 file.txt
               1 File(s)              0 bytes
               2 Dir(s)  243,379,408,896 bytes free

 

 

 

jamielaird
14 - Magnetar

Hi @roe_r 

 

Did you manage to get this to work? If so please could you mark the solution as accepted - it's really appreciated in the community.

 

Cheers!

roe_r
7 - Meteor

Even after changing the registry to enable long windows file names, I'm still having some trouble in Windows with long file names so I suspect that something else might be giving me trouble.  The solution proposed by @jamielaird should work, although I just gave up on this as it was related to a time sensitive analysis and I could move things to folders with shorter paths for now.

Labels