delete-file

Remove element from nested redux state

独自空忆成欢 提交于 2019-11-28 13:01:28
I want to remove a element from my redux state. Im using seamless-immutable and its API to operate on the state. But I couldn't find any nice looking way to delete a element when the state is nested. So the element I want to delete is: state.shoppingcartReducer.products[articleNr] Thanks! import Immutable from 'seamless-immutable' import { addToShoppingcart, createShoppingCart } from '../actions/shoppingcartActions' const CREATE_SHOPPING_CART = 'CREATE_SHOPPING_CART' const ADD_PRODUCT = 'ADD_PRODUCT' const DELETE_PRODUCT = 'DELETE_PRODUCT' const UPDATE_QUANTITY = 'UPDATE_QUANTITY' const

Batch file and DEL errorlevel 0 issue

陌路散爱 提交于 2019-11-28 12:54:56
The batch has to remove files and directories from specific locations and output success or stdout/stderr messages to a new .txt file. I have created the most of the script and it performs exactly as it should, except when the deletion is successful it moves forward to the next line rather than echo a 'successful' message on the log. echo Basic Deletion Batch Script > results.txt @echo off call :filelog >> results.txt 2>&1 notepad results.txt exit /b :filelog call :delete new.txt call :delete newer.txt call :delete newest.txt call :remove c:\NoSuchDirectory GOTO :EOF :delete echo deleting %1

MS Dos Batch delete old files in directory [duplicate]

本秂侑毒 提交于 2019-11-28 12:40:25
Possible Duplicate: Batch file to delete files older than N days I'm trying to make a DoS Batch file to go through a directory with about 500,000 files in it, and i would like it to delete all the files older then 1 year Here's my code so far @echo off title File Exclusion Act for /f "usebackq delims=|" %%f in (`dir /b "C:\Users\Travis\Desktop\LotsOfFiles"`) do echo %%f pause So far it loops and prints out all the files in the specified directory. Any tips/help is highly appreciated. The Batch file below must be called with the number of days for old files to remove from today. For example,

Java file delete and System.gc()

本小妞迷上赌 提交于 2019-11-28 10:35:12
问题 In my app I'm writing a file to store some execution info and once the execution is done I want to delete the temp file. The issue is even after file close or flush by streams I cannot delete the file. I tried Thread.sleep(1000); file.delete(); and that didn't delete the file either. I then created a while loop while(!file.delete()) Thread.sleep(1000); and it was looping forever. I then added System.gc(); file.delete(); and it worked!!! I have verified that I have gracefully closed or flushed

How to delete app cache for all apps in Android M?

风格不统一 提交于 2019-11-28 09:17:14
Is there an option to delete the cache of all Apps or certain Apps in Android M ? Seems like most ways don't work anymore in Android M. As a reference I used this Code out of this discussion : Android: Clear Cache of All Apps? PackageManager pm = getPackageManager(); // Get all methods on the PackageManager Method[] methods = pm.getClass().getDeclaredMethods(); for (Method m : methods) { if (m.getName().equals("freeStorage")) { // Found the method I want to use try { long desiredFreeStorage = 8 * 1024 * 1024 * 1024; // Request for 8GB of free space m.invoke(pm, desiredFreeStorage , null); }

Delete files older than x days

扶醉桌前 提交于 2019-11-28 07:12:48
How can I find out when a file was created using java, as I wish to delete files older than a certain time period, currently I am deleting all files in a directory, but this is not ideal: public void DeleteFiles() { File file = new File("D:/Documents/NetBeansProjects/printing~subversion/fileupload/web/resources/pdf/"); System.out.println("Called deleteFiles"); DeleteFiles(file); File file2 = new File("D:/Documents/NetBeansProjects/printing~subversion/fileupload/Uploaded/"); DeleteFilesNonPdf(file2); } public void DeleteFiles(File file) { System.out.println("Now will search folders and delete

How can I make my .NET application erase itself?

旧城冷巷雨未停 提交于 2019-11-28 05:53:05
How can I make my C# app erase itself (self-destruct)? Here's two ways that I think might work: Supply another program that deletes the main program. How is this deleter program deleted then, though? Create a process to CMD that waits a few seconds then deletes your file. During those few seconds, you close your application. Both of those methods seem inefficient. I have a feeling that there's some built-in flag or something in Windows that allows for such stuff. How should I do it? Also, can you provide some sample code? UPDATE: Thanks for all your answers! I'm going to try them, and see

Undo delete in GIT

守給你的承諾、 提交于 2019-11-28 04:37:46
I made something very stupid. I made a commit using git commit (file edits + new files) (C). Then I made amend last commit. Then I deleted all files recursively (!) using git rm -r Then I made another git commit (C). A-B-C ↑ master Is there any way to undelete the files but keep the changes I had in my first commit? (C) I'd rather do not go back to (B). I tried git reset --soft head^, so then the git status lists files I deleted, then I did git checkout, but still no luck. I don't even know if it's possible. manojlds Do yourself a favour and do not do git checkout <hash> like the other answer

Delete files or folder recursively on Windows CMD

前提是你 提交于 2019-11-28 03:37:25
How do I delete files or folders recursively on Windows from the command line? I have found this solution where path we drive on the command line and run this command. I have given an example with a .svn file extension folder: for /r %R in (.svn) do if exist %R (rd /s /q "%R") DGuntoju Please execute the following steps: Open the command prompt Change directory to the required path Give the following command del /S *.svn Lucas The other answers didn't work for me, but this did: del /s /q *.svn rmdir /s /q *.svn /q disables Yes/No prompting /s means delete the file(s) from all subdirectories.

How to delete many 0 byte files in linux?

≡放荡痞女 提交于 2019-11-28 03:15:17
I've a directory with many number of 0 byte files in it. I can't even see the files when I use the ls command. I'm using a small script to delete these files but sometimes that does not even delete these files. Here is the script: i=100 while [ $i -le 999 ];do rm -f file${i}*; let i++; done Is there any other way to do this more quickly? Use find combined with xargs . find . -name 'file*' -size 0 -print0 | xargs -0 rm You avoid to start rm for every file. With GNU's find (see comments), there is no need to use xargs : find -name 'file*' -size 0 -delete You can use the following command: find .