community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

Directory tool can't read subdirectories with long file paths

Alteryx Certified Partner

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.

Alteryx Certified Partner

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?

 

Screenshot 2019-05-15 at 15.48.42.pngYes I did create all these foldersScreenshot 2019-05-15 at 15.49.17.pngWorks fine..

Alteryx Certified Partner

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

Alteryx Certified Partner

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

 

 

 

Highlighted
Alteryx Certified Partner

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!

Alteryx Certified Partner

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