(I still want to ensure that the folder is empty before removing it,
but
I don't know how to check if a directory is empty, suggestions?)

Forgot about this in my other reply.... You can check if a directory is empty by doing a quick file(GLOB on it and counting the number of results.

This code, saved as a *.cmake script, and then run with -P in various directories:

   set(dir ".")

   file(GLOB r1 "${dir}/*")
   list(LENGTH r1 n1)
   message("n1='${n1}'")

   file(GLOB r2 "${dir}/*.*")
   list(LENGTH r2 n2)
   message("n2='${n2}'")

convinces me that n1 and n2 should both be 0 in an empty directory, and non-0 in a directory that contains any subdirs or files, even invisible ones like .git.


HTH,
David

--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to