# Function not recognized..HELP

**URL:** <https://forums.powershell.org/t/function-not-recognized-help/14272>\
**Category:** PowerShell Help\
**Created:** [April 28, 2020, 8:27am UTC](https://forums.powershell.org/t/function-not-recognized-help/14272 "2020-04-28T08:27:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 28, 2020, 8:27am UTC](https://forums.powershell.org/t/function-not-recognized-help/14272/1 "2020-04-28T08:27:38Z")

</div>

```
function movedata {

```
param ($sourcePath, $targetPath, $files, $newPath)

$sourcePath = \\host-name\share-name\file_path

Write-Output "$sourcePath"

$targetPath = \\host-name\share-name\file_path

Write-Output "$targetPath"

$files = Get-ChildItem $sourcePath -Recurse | Where-Object { $_.LastWriteTime -gt (get-date).date }

$newPath = Join-Path -Path $targetPath -ChildPath ($_.LastWriteTime)

if (!(Test-Path -Path $newPath)) {

    Write-Output "Creating directory $newPath"

    New-Item -Path $newPath -ItemType Directory

}

Compress-Archive -DestinationPath $targetPath.zip

Write-Output "$files"

Write-Output "Starting copy"

ForEach-Object {Move-Item -path $sourcePath -destination $targetPath}

Write-Output "$files copied to $targetPath"

```

}
```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [April 28, 2020, 8:29am UTC](https://forums.powershell.org/t/function-not-recognized-help/14272/2 "2020-04-28T08:29:44Z")

</div>

This scripts purpose is to move data (recursively) by date modified across environments.

---

<div class="post-metadata">

**Author:** ![krzydoug](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/krzydoug/32/1008_2.png) [@krzydoug](https://forums.powershell.org/u/krzydoug)\
**Post date:** [April 28, 2020, 4:05pm UTC](https://forums.powershell.org/t/function-not-recognized-help/14272/3 "2020-04-28T16:05:35Z")

</div>

I recognize that function. Not sure if this resolves your issue or not. Could you elaborate?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/function-not-recognized-help/14272/4 "2024-05-16T20:29:48Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


