Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. --[[ What's the easiest way to delete all the files with AMS except one? Here is a simple snippet to do the job:]]
  2.  
  3. -- The function
  4. function File.DeleteAllExcept(strPath, strFile)
  5. tblFiles = File.Find(strPath, "*.*", false, true, nil, nil);
  6. for i,e in pairs(tblFiles) do
  7. strPath = String.SplitPath(tblFiles[i]);
  8. strFilename = strPath.Filename..strPath.Extension;
  9. if strFilename ~= strFile then
  10. File.Delete(tblFiles[i], false, false, false, nil);
  11. end
  12. end
  13. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement