| View previous topic :: View next topic |
| Author |
Message |
gavrielsinvani Cheater
Reputation: 0
Joined: 29 May 2019 Posts: 36
|
Posted: Mon Jun 03, 2019 1:09 pm Post subject: how i delete file ?, please help me |
|
|
i want delete file, and it's not working,
FileToCheck = [[GKExists.ini]] -- Change Patch for safley software.
file = io.open (FileToCheck)
os.remove(FileToCheck)
file:close()
|
|
| Back to top |
|
 |
TheyCallMeTim13 Wiki Contributor
Reputation: 51
Joined: 24 Feb 2017 Posts: 976 Location: Pluto
|
Posted: Mon Jun 03, 2019 4:57 pm Post subject: |
|
|
Close the file before trying to remove it.
_________________
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Mon Jun 03, 2019 7:39 pm Post subject: |
|
|
| Code: | local path = TrainerOrigin or getMainForm() or path
local FileToCheck = path..'\\GKExists.ini' --- or dir of where 'GKExists.ini' located
local file = assert(io.open (FileToCheck, "r"))
local content = file:read("*all")
file:close()
os.execute("taskkill /F /IM GKExists.ini") -- to make sure no hidden process
os.remove(path.."\\GKExists.ini")
-- do something with content |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
gavrielsinvani Cheater
Reputation: 0
Joined: 29 May 2019 Posts: 36
|
Posted: Wed Jun 05, 2019 8:40 am Post subject: |
|
|
| Corroder wrote: | | Code: | local path = TrainerOrigin or getMainForm() or path
local FileToCheck = path..'\\GKExists.ini' --- or dir of where 'GKExists.ini' located
local file = assert(io.open (FileToCheck, "r"))
local content = file:read("*all")
file:close()
os.execute("taskkill /F /IM GKExists.ini") -- to make sure no hidden process
os.remove(path.."\\GKExists.ini")
-- do something with content |
|
its not work ,
File is not deleted and it is discouraging
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Jun 05, 2019 9:16 am Post subject: |
|
|
where or what is the directory/folder name which "GKExists.ini" locate?.
example: "C:\GKExists.ini" or "D:\Game\blabla\GKExists.ini" whatever?.
Then use:
os.remove("The directory where is GKExists.ini exist\\GKExists.ini")
Note: You need to close the file "GKExists.ini" first and the game which calls this file.
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
gavrielsinvani Cheater
Reputation: 0
Joined: 29 May 2019 Posts: 36
|
Posted: Wed Jun 05, 2019 9:35 am Post subject: |
|
|
| Corroder wrote: | where or what is the directory/folder name which "GKExists.ini" locate?.
example: "C:\GKExists.ini" or "D:\Game\blabla\GKExists.ini" whatever?.
Then use:
os.remove("The directory where is GKExists.ini exist\\GKExists.ini")
Note: You need to close the file "GKExists.ini" first and the game which calls this file. |
C
| Code: |
Its Create File (Working):
file = io.open("GKExists.ini", "w")
file:close()
|
| Code: |
its Remove File (Working):
local FileToCheck = 'GKExists.ini' --- or dir of where 'GKExists.ini' located
local file = assert(io.open (FileToCheck, "r"))
local content = file:read("*all")
file:close()
os.execute("taskkill /F /IM GKExists.ini") -- to make sure no hidden process
os.remove("GKExists.ini")
|
but check if the file exists (Not Working):
| Code: |
if file ~= nil
then
messageDialog("GKTrainer Already Running!", mtError, mbOK)
else
print('No File Exist')
end
|
please help me bro
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Wed Jun 05, 2019 11:52 am Post subject: |
|
|
You did not tell specific. You need to check a file is exist or to check if a PROCESS is open and running. But, whatever...
| Code: | --#1 Check if file exists on a directory or a folder/subfolder
file = 'C:\\GKExists.ini' -- or whatever file name you need check
local f=io.open(file,"r")
if f~=nil then
print('file exist'..file)
io.close(f)
return true else
print('No File Exist')
return false end
--#2 Check if PROCESS exist or running on computer memory
-- First option
processname = "firefox.exe"
filedata = io.popen("tasklist /NH /FO CSV /FI \"IMAGENAME eq "..processname.."\"")
output = filedata:read()
filedata:close()
if output ~= "INFO: No tasks are running which match the specified criteria." then
print(processname..' is running')
-- os.execute("taskkill -im "..processname)
else
-- Program is not running
print(processname..' is not running')
end
-- Second option
processname = "firefox.exe"
local pl = getProcessList()
for pid, name in pairs(pl) do
if name == processname then
print('found'..name..'is running'
break
else print('Hei..'..name..'not found, please contact Mr.Frodo to purchase')
end
end
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
gavrielsinvani Cheater
Reputation: 0
Joined: 29 May 2019 Posts: 36
|
Posted: Wed Jun 05, 2019 12:25 pm Post subject: |
|
|
| Corroder wrote: | You did not tell specific. You need to check a file is exist or to check if a PROCESS is open and running. But, whatever...
| Code: | --#1 Check if file exists on a directory or a folder/subfolder
file = 'C:\\GKExists.ini' -- or whatever file name you need check
local f=io.open(file,"r")
if f~=nil then
print('file exist'..file)
io.close(f)
return true else
print('No File Exist')
return false end
--#2 Check if PROCESS exist or running on computer memory
-- First option
processname = "firefox.exe"
filedata = io.popen("tasklist /NH /FO CSV /FI \"IMAGENAME eq "..processname.."\"")
output = filedata:read()
filedata:close()
if output ~= "INFO: No tasks are running which match the specified criteria." then
print(processname..' is running')
-- os.execute("taskkill -im "..processname)
else
-- Program is not running
print(processname..' is not running')
end
-- Second option
processname = "firefox.exe"
local pl = getProcessList()
for pid, name in pairs(pl) do
if name == processname then
print('found'..name..'is running'
break
else print('Hei..'..name..'not found, please contact Mr.Frodo to purchase')
end
end
|
|
wow thank you for all methods,
thank you very very much !! ..
|
|
| Back to top |
|
 |
|