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,
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.
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.
@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.
@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, 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:
Bumping up the path length one more char, to 201, it failed:
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)
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).
Thanks, @ChrisHemedinger. I'll put in a ticket with tech support.
I would suggest simplifying your directory structure.
https://www.amazon.com/Doctor-hurts-when-Jokes-Cartoons/dp/150043230X
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.