Tag for questions regarding file deletion. O.S. independent.
Questions tagged [delete-file]
2105 questions
0
votes
2 answers
how to delete file after the JVM terminates?
I am working on a media player application and I want to delete the decrypted media file which is created in a specific folder after running the encrypted media file as soon as the JVM terminates.
I tried using deleteOnExit(); function but after…

XYZ
- 15
- 1
- 6
0
votes
1 answer
C# webapi - file.delete - security issue on IIS_USER delete permission?
I have an API that upload a file. Before saving it, the api check if an old file is exists (internal call the DB to get the old file name). If the old file exists, there is delete command (file.delete)
In order not to get…

Yaniv Ben Yohana
- 27
- 8
0
votes
2 answers
How to delete everything inside a notwork folder
I would like to delete everything inside a folder on a network drive, but not the folder itself. It's school drive, therefore I can't delete the folder and replace it. If I try to delete the folder, it will look like i deleted it, until I restart my…

error 40
- 17
- 8
0
votes
1 answer
Deleting files from download folder using Python
I am trying to delete files from my download folder but I get and error that read PermissionError: [WinError 5] Access is denied: 'C:\\Users\\Downloads'
I tried running Visual Studio as admin and adding a code to elevate privileges but I still get…

jordan23
- 73
- 1
- 12
0
votes
1 answer
Delete all the files after copying in new folder
'Start Button' does the following:
Check the given folder path for .blf files
Copy all the existing .blf files to the destination folder …

A R.
- 313
- 3
- 12
0
votes
2 answers
Deleting folders over network
Over a network path, two huge sized folders are added every day with naming format BKP_YYYYMMDDhhmm . When we try to manually delete those folders for housekeeping, it throws well known error:
SOURCE PATH TOO LONG
So I created below housekeeping…

Aarie
- 39
- 7
0
votes
3 answers
How to perform recursive delete using glob pattern in a directory using python?
DirA
file1.txt
file2.conf
DirB
file3.txt
file4.sh
file5.sh
DirC
file6.bat
file7.txt
In above example dir I need to perform recursive delete with glob pattern.
pattern = ['*,txt','*.sh']
Using the…

ArockiaRaj
- 588
- 4
- 17
0
votes
2 answers
How to delete an image that is attached to a record from my database from its folder?
When I delete a record from my database everything is deleted except the image file from the folder.
In the Save Action I have the upload method that is working fine.
The DeleteConfirmed Action works only for deleting the records and not the image…

Μιχαηλ Τσιγαρας
- 1
- 2
0
votes
1 answer
Delete a folder using starts with in ANT
I am comparing 2 folders A and B, and wanted to delete folders and jars present in B which are not present in folder A.
I have written the logic to get needed files to delete, but i do not wanted to delete the directory and jars starting with…

Kivi
- 485
- 1
- 9
- 26
0
votes
1 answer
Delete files extracted with xorriso
I was looking for a way to extract an iso file without root access.
I succeeded using xorriso.
I used this command:
xorriso -osirrox on -indev image.iso -extract / extracted_path
Now when I want to delete the extracted files I get a permission…

Menacer
- 23
- 1
- 5
0
votes
1 answer
Trouble Deleting files programmatically in VBA
I had a hard time with Windows 7 OS to where it would think that certain folders are in usage (not allowing folder delete), when in fact they aren't.
After alot of research and trial and error, I was able to use a command that worked well on…

Heap of Pinto Beans
- 677
- 2
- 12
- 23
0
votes
2 answers
Delete all but latest two files matching wildcard
import glob
import os
filelist=glob.glob("/home/test/*.txt")
for file in filelist:
os.remove(file)
I'm able to delete all files through above code. But I don't want to delete latest 2 files out of 10 txt files.Rest of them wanted to be…

Victory
- 121
- 1
- 3
- 18
0
votes
2 answers
Unlink sometimes fails - needs improvements
I use this custom, simple script I made, somehow it's failing but it always returns true.
This class unlink the files that are placed in an array which goes through them then increments the counter on success of a file that was deleted, this is my…

MacMac
- 34,294
- 55
- 151
- 222
0
votes
0 answers
How to delete ".txt files only" from a folder which are older than 30 days
I am trying to delete .txt files which are 30 days old from a folder. Please note that this folder has other files types too, for example a subfolder with .bat files.
I am trying to use "forfiles /p %source% /s /d -30 /c "cmd /c del @file : date >=…

Aditya
- 3
- 1
- 2
0
votes
1 answer
Delete files from a folder based on an existing set of files in another folder
This one I couldn't find a proper answer.
I have 2 folders. One is called 'src', where
my java source code is located. The other one
is called 'srcGenerated' and has a set of files
created by a code generator. srcGenerated is a
superset of src.
I…

Rod
- 1
- 1