I have a files I need to remove within a certain file structure from a certain directory but have multiple directories but within the structure there is a defining folder.

e:\archive\ *\3 WIP\ *...\ *.fem

the \ *\ - I need a wild card as I have many

the \ *...\ - I need a wild card for multiple folders depths ( *\ *\ *\ *\ *.fem) in which I need any *.fem files deleting.

The \3 WIP\ is the defining directory.

Can anyone help ?

  • Yes it is possible, but unfortunately I can't show how off the top of my head. – Dog Lover Aug 20 '15 at 12:33
  • Cheers Dog Lover at least while I am looking how to do it. It may at least be possible. :-) – Mr B Aug 20 '15 at 12:46

Either go to the root of E: and simply run:

DEL /Q *.fem /s

or: DEL /Q E:\archive\3 WIP\*.fem /s

Note: The /s is key as it traverses all of the subfolders under it.

Just run: DEL /? for help in how to use it.

if you don't want to do this from a command-line, search out *.fem from Windows Explorer and delete from there.

| improve this answer | |
  • Cheers Leptonator, I am aware of above but my file structures are many and I have variable folders after archive and before 3 WIP ( archive / * / 3 WIP/ its that one that's causing me trouble, I'm presuming it will have to be in a batch file and be a multi line command. There are more than a couple hundred of these file structures in total :-( – Mr B Aug 21 '15 at 10:02

You can do this whith Powershell. There is the get-childitem cmdlet. Something like get-childitem e:\archive -include *.fem -recurse should give you a list with all *.fem files in e:\archive. You could then pipe this to a cmdlet to remove the files:

get-childitem e:\archive -include *.fem -recurse| foreach ($_) {remove-item $_.fullname}

| improve this answer | |
  • Cheers duenni I looked at this command but was unsuccessful, is it because I need a Wildcard after the archive but then I need 3 WIP so e: \archive \ * \ 3 WIP \ – Mr B Aug 21 '15 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.