Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[ What's the easiest way to delete all the files with AMS except one? Here is a simple snippet to do the job:]]
- -- The function
- function File.DeleteAllExcept(strPath, strFile)
- tblFiles = File.Find(strPath, "*.*", false, true, nil, nil);
- for i,e in pairs(tblFiles) do
- strPath = String.SplitPath(tblFiles[i]);
- strFilename = strPath.Filename..strPath.Extension;
- if strFilename ~= strFile then
- File.Delete(tblFiles[i], false, false, false, nil);
- end
- end
- end
- -- Example:
- File.DeleteAllExcept(_DesktopFolder.."\\Personal Pictures\\", "rainyday.jpg")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement