Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find and delete a file with CMD command?

Tags:

I know the filename, say myfile.pdf. But I do not know its location because my web application created it temporarily. When the user disconnect from the application then I want this file to be deleted. So how to search and delete the file?

like image 718
pheromix Avatar asked Jul 13 '16 09:07

pheromix


1 Answers

del path\filename /s

e.g.

del c:\test\h.bat /s

Will delete h.bat in any sub folders from the test directory.

To search and delete on an entire drive: -

del c:\test.bat /s

The S switch deletes all specified files from all subdirectories.

like image 192
Gary Avatar answered Sep 28 '22 03:09

Gary