Ad

How To Remove Some Filenames From The List Of All Filenames In That Folder

- 1 answer

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.

Ad

Answer

. 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.

Ad
source: stackoverflow.com
Ad