delete-file

VBA FreeLibrary doesn't unload DLL

↘锁芯ラ 提交于 2019-12-24 09:47:54
问题 I need to delete a DLL file when I am done using it (cleanup after code is completed). I try using "LoadLibrary" and "FreeLibrary" in Excel VBA but no matter what I do Excel.exe clings to the DLL file. Public Declare PtrSafe Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long Public Declare PtrSafe Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long Private Sub Load_Unload_DLL() Dim lb As Long, pa As Long lb = LoadLibrary("C:

Spring Integration, delete file in outbound channel adapter

帅比萌擦擦* 提交于 2019-12-24 05:48:32
问题 I am using Spring Integration to poll a directory for a File, process this file in a service class, write this file to an output directory and then delete the original file. I have the following XML configuration: <int-file:inbound-channel-adapter id="filesInChannel" directory="file:${java.io.tmpdir}/input" auto-create-directory="true" > <int:poller id="poller" fixed-delay="1000" /> </int-file:inbound-channel-adapter> <int:service-activator id="servicActivator" input-channel="filesInChannel"

File.Delete cannot delete a file because it is being used by another process. Not sure how to fix this

谁说我不能喝 提交于 2019-12-24 04:56:15
问题 I have a project where I have a web form that generates a .csv file on the fly and then is encrypted using GnuPG. The encryption process works and the encrypted file is generated in the same directory. Next, after the file is encrypted, I need for the regular .csv file to be deleted. I have used file.delete to do this but I am getting the error "The process cannot access the file 'FILEPATH/FILENAME.EXT' because it is being used by another process. I am unsure if I placed the code in the wrong

Delete all files inside a folder but the last?

主宰稳场 提交于 2019-12-24 02:40:15
问题 I'm looking for a script to loop through a folder and delete all the files inside it but the last, most recent one ( I have marked the name of each file as filename_date('Y')_date('m')_date('d').extension) , not sure if relevant ). I have found this script here on stack: if ($handle = opendir('/path/to/your/folder')) { $files = array(); while (false !== ($file = readdir($handle))) { if (!is_dir($file)) { // You'll want to check the return value here rather than just blindly adding to the

Get File Creation Time

北城以北 提交于 2019-12-24 02:02:33
问题 I want to get a time of all files that are in this folder ("/sdcard/Files/"). And then I want to delete all the files that have more than one hour. Is there any method to do it? 回答1: File dir = new File("/sdcard/Files/"); File[] files = dir.listFiles(); for (int i = 0; i < files.length; ++i){ long lastTime = files[i].lastModified(); Date nowDate = new Date(); long nowTime = nowDate.getTime(); if (nowTime - lastTime > 60*60*1000){ files[i].delete(); } } I hope it can help you. 来源: https:/

Check if a file is in use, wait for it to finish

佐手、 提交于 2019-12-23 13:43:06
问题 I have this problem in my application: Step 1 - create an file (xml) and put some content in it Step 2 - a 3rd party application will open the file and get the info from the file made in step 1. Step 3 - delete the file again. The first question that I have is about this part of the code: XmlDocument xmlDoc = new XmlDocument(); DataSet ds = //use a method to put in the data xmlDoc.LoadXml(ds.GetXml()); xmlDoc.Save("Filename"); // ... Process.Start(startInfo); Is my assumption correct that the

How to undo git rm -rf dirname without a first commit?

十年热恋 提交于 2019-12-23 07:49:36
问题 I did: git init git add . git rm -rf dirname Looking at other answsers, git reset --hard HEAD , git checkout -f and git reflog did not work, apparently because there is no HEAD to go back to, nor a commit to get the files back from. Is there a way to get the files back? 回答1: There is no way. Usually, git rm checks the files have already been committed before deleting them, so you don't lose any of your work. However, using -f overrides this check. In short: Don't use -f . Don't touch anything

How to delete the file after 30 seconds?

删除回忆录丶 提交于 2019-12-23 06:26:08
问题 I am working on a C# project and i need the file to deleted after 30 seconds. So once the file sent to the machine i need the software to count till 30 seconds and lets say.. show a splash form and then delete the file. Please help me out. So in my case i am copying the file to the bin/debug folder. and after 30 seconds i need to delete the file.. This is my code: private void button4_Click(object sender, EventArgs e) { //string filePath = image_print(); // MessageBox.Show(filePath, "path");

delete uploaded file from an array of id when they are delted in joomla?

℡╲_俬逩灬. 提交于 2019-12-23 05:41:51
问题 I am trying to delete an array of ids and when it gets deleted I want the uploaded pic associated with it also to get deleted using unlink. I am using joomla and mysql for the admin mvc component in joomla. My code for controller in remove is has follows: function remove() { $arrayIDs = JRequest::getVar ( 'cid', null, 'default', 'array' ); //Reads cid as an array $model = & $this->getModel ( 'greetings' ); jimport ( 'joomla.filesystem.file' ); if (is_array ( $arrayIDs ) && count ( $arrayIDs )

delete uploaded file from an array of id when they are delted in joomla?

柔情痞子 提交于 2019-12-23 05:41:35
问题 I am trying to delete an array of ids and when it gets deleted I want the uploaded pic associated with it also to get deleted using unlink. I am using joomla and mysql for the admin mvc component in joomla. My code for controller in remove is has follows: function remove() { $arrayIDs = JRequest::getVar ( 'cid', null, 'default', 'array' ); //Reads cid as an array $model = & $this->getModel ( 'greetings' ); jimport ( 'joomla.filesystem.file' ); if (is_array ( $arrayIDs ) && count ( $arrayIDs )