Home > Software engineering >  How to remove files starting with dot (.) from a directory?
How to remove files starting with dot (.) from a directory?

Time:12-07

I have a list of files and folders inside a directory. For example, .jazz or .project file after a checkout.

I am using batch script currently, May I know how to remove .jazz or .project files from my Jenkins workspace ?

CodePudding user response:

Just like @Squashman said in the comments, you can use the wildcard symbol * combined with anything.

So in your case it is: del /f ".jazz*" Use del /f /s ".jazz*" if there are directories too.

See this documentation for more information.

CodePudding user response:

You can do this by using UNC (Universal Naming Convention) for paths. For example in windows you can delete folders with:

rmdir \\.\c:\YourFolder\.dir_to_remove

On *nix systems you need to change the direction of the slash (\ to /).

ref: https://en.wikipedia.org/wiki/Path_(computing)#UNC

  • Related