Hi
I'm a ***
I'm inside a batch
and I need to delete a file only if it exist, using powershell. Is there a way?
something like
Code:if exist file.txt del file.txt
thanks
+ Reply to Thread
Results 1 to 4 of 4
-
-
If it doesn't exist, there won't be anything that needs deleting, so even if it errors, no big deal, as long as you account for it in the flow.
Btw, hint: sometimes the flow works better if it is set up more in the manner of "if not exist...".
You'll have to try those on your own, though. You may purport to be a cat but I am a busy human, so don't have time to further help.
ScottLast edited by Cornucopia; 21st Mar 2022 at 17:57.
-
Do you ever even try? I did a simple search for "powershell delete file if it exists". The first result was:
https://buildvirtual.net/powershell-how-to-delete-a-file-if-it-exists/ -
Just do a usb linux boot and delete the file that way.
I think,therefore i am a hamster.
Similar Threads
-
Batch remux mkv to mp4 with Windows PowerShell
By [ss]vegeta in forum Newbie / General discussionsReplies: 0Last Post: 22nd Dec 2020, 14:48 -
windows dos batch cat: WHAT UNTIL A FILE EXIST ?!?
By marcorocchini in forum Newbie / General discussionsReplies: 4Last Post: 18th Jun 2020, 16:58 -
how to add time counter of exist video file ?
By yanshof in forum ProgrammingReplies: 4Last Post: 10th May 2019, 02:57 -
Encoding mkv from avs, powershell problem
By amonowy in forum Newbie / General discussionsReplies: 8Last Post: 5th Jan 2018, 05:37 -
script that verify if a video stream exist or not in a file?
By marcorocchini in forum Newbie / General discussionsReplies: 2Last Post: 18th Aug 2017, 12:18