Delete AUC File Of Users
static void ClearAucFileForUsers(Args _args)
{
System.Array files;
int fileCount;
int i;
str nextFile;
str path = "C:\\Users";
str Finalpath;
str pattern = "*.auc";
container listOfFiles;
int DirCount;
System.Array Directories;
int j;
str nextDir;
container listOfDir;
FileIOPermission dirPermission, filePermission;
InteropPermission interopPermission;
Set permissionSet;
new InteropPermission(InteropKind::ClrInterop).assert();
listOfDir = conNull();
listOfFiles = connull();
Directories = System.IO.Directory::GetDirectories(path);
if(Directories)
{
DirCount = Directories.get_Length();
for(j=0; j < DirCount; j++)
{
nextDir = Directories.GetValue(j);
Finalpath = nextDir + "\\AppData\\Local";
listOfDir += Finalpath;
}
}
j=0;
DirCount = conLen(listOfDir);
while( j < conLen(listOfDir))
{
j++;
Finalpath = conPeek(listOfDir,j);
try
{
files = System.IO.Directory::GetFiles(Finalpath, pattern);
}
catch
{
continue;
}
if (files)
{
fileCount = files.get_Length();
for(i=0; i < fileCount; i++)
{
nextFile = files.GetValue(i);
System.IO.File::Delete(nextFile);
info(nextFile);
}
}
}
CodeAccessPermission::revertAssert();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.