Why Aren’t My Specified Directories Being Ignored in My Duplicate File Script?

0
17
Asked By CuriousCoder42 On

Hey everyone! I've been working on a script to help me find duplicate files on my system, but I'm running into an issue where it's not ignoring certain directories like I intended. In particular, I'm trying to exclude directories such as "C:Usersrdan.vscodeextensions". I've shared the part of the script doing this below. I would really appreciate any insights into what I might be doing wrong!

3 Answers

Answered By ScriptSleuth99 On

I noticed that you mentioned trying to ignore certain directories, but it seems like the relevant portion of the code where those checks should occur is missing. Can you show how you're handling the directory exclusions in your script? That would help us assist you better.

CuriousCoder42 -

I added the entire script to be clearer, thanks for your patience!

Answered By DebuggingPro On

Just a quick note: if you want to ignore those folders, make sure you reference the $IgnoreFolders variable somewhere in your Get-ChildItem logic. Otherwise, your script won't know to skip them. It sounds simple, but it's easy to overlook!

CuriousCoder42 -

You're right! I need to integrate it properly. Thanks for the reminder!

Answered By HelpfulNerd74 On

It looks like you're defining your $IgnoreFolders variable, but you're not actually using it in your script to filter the directories being scanned. You should add a check in your file collection section to skip over any folders listed in $IgnoreFolders. That might solve your problem!

CuriousCoder42 -

Thanks for pointing that out! I'll work on implementing that check.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.