if($file -match '^(I[A-Z]\d{6}_' | Foreach { $Matches[0] }) {
Hi we have a ERP system that looks into a map where are shortcuts to documents. the map of documents is now to big a lot of documents. I want to copy some documents to a higher map 2018. and i want to restore the shortcuts. my orders are beginning with a I and then a letter. i get a fout in the position above
<!–more–>
## Hugo Maris VDL Industrial Products ## 11-2018 echo "------Logistix Data Robot By Hugo Maris------" #Locatie's $plotlocation ="C:\test\2018\"; $shortcutlocation= "C:\test\dosyslog\"; function CreateShortcut { Param($sourcefile, $destenationpath) echo "--CreateShortcut()--"; $shortcutpath = $destenationpath + ".lnk"; if (!(Test-Path $shortcutpath)) { echo "s> s> $sourcefile"; echo "s> d> $shortcutpath"; $Shell = New-Object -ComObject ("WScript.Shell"); $ShortCut = $Shell.CreateShortcut($shortcutpath); $ShortCut.TargetPath=$sourcefile; $ShortCut.Save(); } echo "--!CreateShortcut()--"; } Get-ChildItem $plotlocation Foreach-Object { $file = $_.Name.toupper() if($file -match '^(I[A-Z]\d{6}_' | Foreach { $Matches[0] }) { $folder = "VerkoopOrder\document\"; $logistixId = $Matches[0] echo "Move to artikel $logistixId" echo $file $filelocation = $_.FullName; $destenationpath = $shortcutlocation + $folder + $logistixId + $file; echo $filelocation echo $shortcutlocation CreateShortcut $filelocation $destenationpath ; } } echo "-------------Einde script-------------";
<!–more–>