Hi,
I have a folder structure that I need cleaning up for duplicate files, but I cant seem to get the syntax right.
I have a bunch of folders with the following structure
Top In Supplier1 OrderConf Invoice Proc Work Supplier2 OrderConf Invoice Proc Work
So documents come in from outside into the Work folder for each supplier. They are then picked up (by an AS/400 using FTP) and FTP renamed to the Proc Folder. This process dies horribly when the file already exists in the Proc folder by looping on that document. How can I pick up all duplicate files (XML's, by name) for all instances of Work that already exist in Proc and move them elsewhere?
Thanks for your help, my skills with PS are still rudimentary.
Vince.
Just a hint would be great. I'm mainly having problems with looping around a foreach in the Supplier level and then looping in the files in the "Work" folder. i can do one, or the other, but not both. i.e. Sorry this is such a basic question, but I'm obviously missing some basic knowledge.
Push-LocationSet-Location 'D:\Top\In\'function ShowDuplicates(){ get-childitem work | foreach { get-childitem 'Invoice\Proc\'$_.Name }}$dirs = Get-childitem | Where-Object { $_.PSIsContainer }$dirs | foreach { Push-Location | Set-Location $_.Name | ShowDuplicates | Pop-Location }
Pop-Location
This doesn't work, but I can test each bit and it works independently in that environment. I apologise for my dumbness and thank you for any help.