Skip hidden files when copying using Powershell

This is my current script ...

copy '.\Alfresco Development Config Files\*' C:\Alfresco\tomcat\shared\classes -rec -force

How can I change that hidden files are skipped?

+3
source share
2 answers

If you do not mind using your own team, then

robocopy '.\Alfresco Development Config Files' C:\Alfresco\tomcat\shared\classes /s /XA:H

(It may be necessary to specify the full path for the source, since the current PowerShell directory and the current working directory of the process are not the same (and cannot be in the general case)).

Fixing the previous version of PowerShell is likely to be possible, but cumbersome.

+1
source

There is probably a shorter way, but maybe this will help:

$NonHiddenObjects = Compare -IncludeEqual `
 -Diff (Dir ".\Alfresco Development Config Files\" -Rec -Force | Select -Exp FullName) `
 -Ref  (Dir ".\Alfresco Development Config Files\" -Rec | Select -Exp FullName) `
 | ?{$_.SideIndicator -eq "=="} `
 | Select -Exp InputObject

copy $NonHiddenObjects C:\Alfresco\tomcat\shared\classes -force
-1
source

All Articles