Hi Andreas, The first part works filename dirRef "P:\Applications and Offers\sub1"; data filesToCopy; did = dopen('dirRef'); do i = 1 to dnum(did); name = dread(did, i); if prxmatch('/.*\.100001$/', trim(name)) then do; output; end; end; run; did i name 1 1 1055OD2018.100001 1 2 1055PD2018.100001 1 3 1055AD2018.100001 The second part does not work for me data _null_; set filesToCopy; rc = filename('fin', name, , 'recfm=f', dirRef); rc = filename('fout', cats(name, '_in'), , 'recfm=f', dirRef); rc = fcopy('fin', 'fout');run; No errors but ignores the rename part _______________________________________________________ The ideal output in ‘dirRef’ should be something like this. 1055OD2018.100001 1055PD2018.100001 1055AD2018.100001 1055OD2018.100001_n 1055PD2018.100001_n 1055AD2018.100001_n I am new to SAS EG Thanks for helping
... View more