BookmarkSubscribeRSS Feed
Princewill
Calcite | Level 5


Hello,

 

I'll like to know if there's a limite in the number of characters in the source/target path of the SAS Enterprise Guide Copy File Task? I noticed when copying from Windows to Linux that source path below 255 characters are truncated. My labtop is Windows 10 and SAS 9.4 is installed on Linux. I have read that Windows paths are limited to 255 characters so not sure why the EG Task is truncating.

 

I understand it is not a good practice to have long path names but these are business folders  with a naming convention. So I'll like to understand the Copy Task limit before considering any review of the folder architecture.

 

My SAS is in French so I have translated the Log to English. So output might be different if you intend to execute at your end.

 

Example KO path length =  236:

source file = D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx

Log:

Dowloading file from "PP20050810" to SAS session on "MMAApp".

Using the following parameters:

Source file specification : D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx

Destination : /users/$USER/sources/

Replace existing file: Yes

Resolve macro varaibles on paths : Yes

Convert end of line for text files : No

NOTE: Resolving macro variable expressions in file paths. SAS Log :

1 ;*';*";*/;quit;run;

2 OPTIONS PAGENO=MIN;

3 %let _egcopySource = D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC

3 ! PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES

3 ! REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx;

4 %let _egcopyTarget = /users/$USER/sources/;

5 %put Source files resolve to &_egcopySource;

Source files resolve to D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC

PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES

REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx

6 %put Target folder resolves to &_egcopyTarget;

Target folder resolves to /users/$USER/sources/

7

8 QUIT; RUN;

9

NOTE: Source file resolves to D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PREC

NOTE: target folder resolves to /users/$USER/sources/

ERROR: the file D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PREC does not exist on PP20050810

NOTE: Copied 0 bytes in 3,98 seconds.

NOTE: number of files : 0

 

Using wilcard OK:

source path:

D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\*

 

Log:

Dowloading file from "PP20050810" to SAS session on "MMAApp".

Using the Following parameters:

Source file specification : D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\*

Destination : /users/$USER/sources/

Replace existing file: Yes

Resolve macro varaibles on paths : Yes

Convert end of line for text files : No

NOTE: Resolving macro variable expressions in file paths. SAS Log :

1 The SAS System 10:01 Monday, June 28, 2021

1 ;*';*";*/;quit;run;

2 OPTIONS PAGENO=MIN;

3 %let _egcopySource = D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC

3 ! PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\*;

4 %let _egcopyTarget = /users/$USER/sources/;

5 %put Source files resolve to &_egcopySource;

Source files resolve to D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC

PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\*

6 %put Target folder resolves to &_egcopyTarget;

Target folder resolves to /users/$USER/sources/

7

8 QUIT; RUN;

9

NOTE: Source file resolves to D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\*

NOTE: Target folder resolves to : /users/$USER/sources/

NOTE: Resolving wildcard character in D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\* to determine files to be downloaded towards the server

Files found :

D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx

Downloading of D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL\CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx vers /users/$USER/sources/CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx ...

…Downloading towards server CHGM_NET_PRECALCUL_PR_202112_20210_1234_260.xlsx, 964 639 bytes

NOTE: Copied 964 639 bytes en 5,22 seconds.

NOTE: Number of files : 1

 

Thanks for your inputs.

 

Regards,

9 REPLIES 9
ChrisHemedinger
Community Manager

I'll have to check on the max length but it might be a limitation of the OS. In the meantime, one possible workaround is to map a drive to a path further down the chain, and thus shorten the path you have to include in the fields.

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
Princewill
Calcite | Level 5

Hi Chris,

Thanks for the quick reply. The workaround is convinient for individual projects. For group projects where users might have different drive letters the UNC path is preferable.

ballardw
Super User

 


@Princewill wrote:

Hi Chris,

Thanks for the quick reply. The workaround is convinient for individual projects. For group projects where users might have different drive letters the UNC path is preferable.



For group projects then consider why the same "word" appears in a path 4 times if it is going to generate paths too long for the operating system to process

 

D:\OAAM\SAS2\groupe2\GPBM_COVEACONTROLEECONOMIQUE\10_Outils\2021\4_SEMESTRIEL\4_4 COVEA\4_4_1 ABC PROD\4_4_1_9 PRECALCUL\4_4_1_9_4 DONNEES REFAC\CHGM_NET_PRECALCUL_PR\PRECALCUL_PRECALCUL

 

If a "word" must be repeated many times in a path that is a candidate for either removal or serious abbreviation.

The inconsistent appearance of spaces in just a few places instead of _ is also a bit questionable.

 

Princewill
Calcite | Level 5

@ballardw Thanks for your comment. In the original path PRECALCUL appears just once. When I came across the error I tried different path lengths to determine the correct value. So I created unmeaningful folders.

ChrisHemedinger
Community Manager
I believe the max file path will be 260 characters. Windows 10 does support longer paths, but I believe the Copy Files task does NOT do the special-case work that would be needed to leverage these. If it's a showstopper you could work with Tech Support to ask this to be addressed, but it would be a bit of a project.
Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
JRoman
Obsidian | Level 7

@ChrisHemedinger, I ran into this same issue today and it looks like there may be a bug in the Copy Files task that is unrelated to the Windows max path length.  After some testing, it appears the path length limit is just 200 chars (not 260) when the option "Resolve SAS macro variables in source and destination paths" is turned on.  (With that option turned off, it worked for me all the way up to 259 chars, at which point Windows was preventing me from increasing the file name length due to the OS limit.)

 

With a 200-char path and the resolve macro vars option turned on, the log shows everything worked fine:

200 chars okay (redacted).png

 

Bumping up the path length one more char, to 201, it failed:

201 chars not okay (redacted).png

 

It looks like a bug with how the task is handling the source path, since lines 20-22 in the failure log show the correct 201-char path, but lines 29 and 32 show that the first 200 chars of the path got clipped off, leaving just a single char.  I tested with additional path lengths beyond 201, and it was consistently dropping the first 200 chars, so a path length of 206, for example, became 6.

 

EG version = 8.3 Update 5 (8.3.5.193) (64-bit)

ChrisHemedinger
Community Manager

Hi @JRoman,

 

If it's blocking your work then I would suggest reporting to SAS Technical Support for tracking. However, there might be something else at play that's limiting this. I built this task and fixed so many of these edge cases along the way...but I can't remember details about the file length.

 

Workarounds include ( @Tom's joke aside) using a mapped drive to shorten the length of the path, or use a symbolic link (for UNIX paths). 

Check out SAS Innovate on-demand content! Watch the main stage sessions, keynotes, and over 20 technical breakout sessions!
JRoman
Obsidian | Level 7

Thanks, @ChrisHemedinger.  I'll put in a ticket with tech support.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 9 replies
  • 1530 views
  • 0 likes
  • 5 in conversation