Home > Software design >  How to remove some filenames from the list of all filenames in that folder
How to remove some filenames from the list of all filenames in that folder

Time:08-11

I created in Stata a list of all files in a folder with the following:

global file_all : dir "$outputsFolder" files "*.dta"

However, I want to remove two files from this list. I wish to create another list of files so that I can remove all the files in this new list from the file_all. I had try the following, but with no success:

global file_remove:  `"${outputsFolder}\dataset1.dta"' `"${outputsFolder}\dataset2.dta"' 

And I also don't know how to create the set difference between those two lists.

CodePudding user response:

. global set A B C D E

. global subset D E

. global diff : list global set - global subset

. di "$diff"
A B C

I read the documentation at help macrolists to imply that you need extra parentheses. Nevertheless the above works.

  • Related