Show the name of the file you are copying. Copy the name an paste it into a text box opened with the forum's </> icon.
The text box is important because the main message windows on this forum will reformat text and may remove characters.
You need to be extremely careful with paths. The code you show here if the first copy worked the second wouldn't because you have a different number of spaces after COVID-19 in the second copy command.
rc= system("copy F:\Data\COVID-19 Report &todaysdate. &ftime..xlsx
F:\brugere\1081_COVID-19 Report &todaysdate. &ftime..xlsx");
rc= system("copy F:\Data\COVID-19 Report &todaysdate. &ftime..xlsx
F:\brugere\1082_COVID-19 Report &todaysdate. &ftime..xlsx");
Hint: make the string represented by using something like:
%put copy F:\Data\COVID-19 Report &todaysdate. &ftime..xlsx F:\brugere\1081_COVID-19 Report &todaysdate. &ftime..xlsx ;
Then copy that result from the log and paste into a command line box on your system.
I suspect you may find that spaces in the path are part of the problem and you get to deal with quoting to make valid paths.
data _null_;
insert = "&todaysdate. &ftime.";
length copystr targstr commandstr $ 200;
copystr = cats(catx(' ','copy "F:\Data\COVID-19 Report',insert),'.xlsx"');
do loop = 1081 to 1085;
targstr = Quote(cats(catx(' ',cats("F:\brugere\",loop,"_COVID-19 Report"),insert),".xlsx"));
put copystr=;
put targstr=;
/* uncomment the following after testing the above*/
/* rc = system (catx(' ',copystr, targstr));*/
end;
run;
copy some of the results of the PUT to see if they work with the copy command in a command window.
Or use the data step to write a command file with the text of the copy commands. Then, as a text, execute the command file from a command prompt/window and see what you get. When you have the syntax correct you could then use the X or SYSTEM to execute the batch file that was written. With care you would then have documentation of what was actually written.
Are you actually getting multiple of these files every day? If not you could simplify things a tad by using the source date followed by an * to reference the source file.
With the Windows copy command if you specify a target directory (folder) with a source file then the same named file gets copied to the directory. So need to use the date or time at all in the target:
copy c:\thisfolder\thatfolder\somefilename.xlsx c:\targetfolder
will make of copy of "somefilename.xlsx" in folder c:\targetfolder
Which should simplify things a bit and reduce places to make type errors.
... View more