delete-file

Deleting a File using php/codeigniter

ぃ、小莉子 提交于 2019-11-30 01:51:50
问题 I would like to delete a file that is found in my localhost. localhost/project/folder/file_to_delete I'm using codeigniter for this. I would like to use the unlink() function in php but I really can't understand how to use it. 回答1: you can use the "file helper" in codeigniter. http://codeigniter.com/user_guide/helpers/file_helper.html and like this : $this->load->helper("file"); delete_files($path); Late Edit: delete_files method uses a path to wipe out all of its contents via unlink() and

How to delete or purge old files on S3?

醉酒当歌 提交于 2019-11-30 01:09:22
Are there existing solutions to delete any files older than x days? Ravi Bhatt Amazon has introduced object expiration recently. Amazon S3 Announces Object Expiration Amazon S3 announced a new feature, Object Expiration that allows you to schedule the deletion of your objects after a pre-defined time period. Using Object Expiration to schedule periodic removal of objects eliminates the need for you to identify objects for deletion and submit delete requests to Amazon S3. You can define Object Expiration rules for a set of objects in your bucket. Each Object Expiration rule allows you to

Bizarre directory delete behaviour on SSD drive

我的未来我决定 提交于 2019-11-30 00:16:23
问题 Directory c:\test has 50 or so files in it, no subdirectories. If IO.Directory.Exists("C:\test") Then IO.Directory.Delete("C:\test", True) End If IO.Directory.CreateDirectory("C:\test") Drive C is Intel's X25-M80 SSD drive, OS is Windows 7 64 bit with TRIM support, Visual Studio is 2008 with target framework 3.5. When above code is executed, CreateDirectory breaks code execution without an (visible) exception. After much headache I found that Delete is not yet done by the time code execution

Java.nio: most concise recursive directory delete

怎甘沉沦 提交于 2019-11-29 23:37:08
I am currently trying to recursively delete a directory... Strangely enough the shortest piece of code I was able to find is the following construct, employing an ad-hoc inner class and in a visitor pattern ... Path rootPath = Paths.get("data/to-delete"); try { Files.walkFileTree(rootPath, new SimpleFileVisitor<Path>() { @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { System.out.println("delete file: " + file.toString()); Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult postVisitDirectory(Path dir,

How to delete a folder with all contents using a bat file in windows?

寵の児 提交于 2019-11-29 20:21:20
I want to delete a folder with all files and subfolders using a bat file. I have tried the following, but it is not working: @DEL D:\PHP_Projects\testproject\Release\testfolder*.* Can anybody help? Jon @RD /S /Q "D:\PHP_Projects\testproject\Release\testfolder" Explanation : Removes (deletes) a directory. RMDIR [/S] [/Q] [drive:]path RD [/S] [/Q] [drive:]path /S Removes all directories and files in the specified directory in addition to the directory itself. Used to remove a directory tree. /Q Quiet mode, do not ask if ok to remove a directory tree with /S user3319853 del /s /q c:\where ever

Force Delete all files from a folder

我与影子孤独终老i 提交于 2019-11-29 17:50:43
问题 I have been using a specific piece of code to delete files from a folder but it is proving very problematic because maybe I forgot to close an InputStream or two. The code I have is so big that I am not be able to see all the Inputstreams that I have not closed. Is there a way of deleting files whether there is an open InputStream or not? This is the piece of the code that I have been using; File fin = new File("C:/ABC Statements final/"); File[] finlist = fin.listFiles(); for (int n = 0; n <

Anyway to detect whether user close the browser using php? [duplicate]

眉间皱痕 提交于 2019-11-29 16:58:32
Possible Duplicate: Detecting Browser exit in PHP I have some user related files in my server and I want them to be deleted when user closes the browser or leaves my page. Is it possible? Is there any way to do it? Not just with PHP. PHP runs server-side, and is far done processing your page by the time the user will have a chance to close their browser. You could technically detect if PHP was still processing the page and the user closes it, with a specific configuration. However, it is not ideal. See connection_aborted() . What you need to do is set up a long-polling connection with

Python Deleting Certain File Extensions

狂风中的少年 提交于 2019-11-29 15:34:47
问题 I'm fairly new to Python, but I have gotten this code to work, and in fact, do what it's intended to do. However, I'm wondering if there is a more efficient way to code this, perhaps to enhance the processing speed. import os, glob def scandirs(path): for currentFile in glob.glob( os.path.join(path, '*') ): if os.path.isdir(currentFile): print 'got a directory: ' + currentFile scandirs(currentFile) print "processing file: " + currentFile png = "png"; jpg = "jpg"; if currentFile.endswith(png)

java Cannot delete file, being used by another process

夙愿已清 提交于 2019-11-29 15:17:48
I have this code import org.apache.commons.io.FileUtils; try { FileUtils.copyURLToFile(new URL(SHA1_LINK), new File("SHA1.txt")); if(!sameSha1()) { System.out.println("sha diferentes"); FileUtils.copyURLToFile(new URL(LINK), new File(PROG)); } } catch (Exception e) { System.out.println("Internet is off"); } //delete SHA1 file Files.deleteIfExists(Paths.get("SHA1.txt")); and when I execute it it says java.nio.file.FileSystemException The process cannot access the file because it is being used by another process (in sun.nio.fs.WindowsException) In the sameSha1() I have this: String sha1Txt = new

Deleting file from FTP in C#

。_饼干妹妹 提交于 2019-11-29 11:58:27
问题 My program can upload files into an FTP server using this code: WebClient client = new WebClient(); client.Credentials = new System.Net.NetworkCredential(ftpUsername, ftpPassword); client.BaseAddress = ftpServer; client.UploadFile(fileToUpload, WebRequestMethods.Ftp.UploadFile, fileName); Right now I need to delete some files and I can't do that right. What should I use instead of client.UploadFile(fileToUpload, WebRequestMethods.Ftp.UploadFile, fileName); 回答1: You'll need to use the