# Appending the Filename

**URL:** <https://forums.powershell.org/t/appending-the-filename/740>\
**Category:** PowerShell Help\
**Created:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/appending-the-filename/740 "2011-12-31T18:30:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![archives](https://avatars.discourse-cdn.com/v4/letter/a/bb73d2/32.png) [@archives](https://forums.powershell.org/u/archives)\
**Post date:** [December 31, 2011, 6:30pm UTC](https://forums.powershell.org/t/appending-the-filename/740/1 "2011-12-31T18:30:00Z")

</div>

by Lahru at 2013-03-19 08:04:10

> I hope there is a simple answer to my simple seeming question.  
> I want to rename all files in a directory.  
> The files that get put in this directory have seemingly random names like a hex designation.  
> All files are either TIF, JPG or PDF files.  
> I want to append some text to the beginning of each filename AND move it. The rename and the move can be 2 separate actions if necessary.  
>   
> So what I have is:  
> c:\share\00-22-64-F4-8E-0C.TIF  
>   
> I wish to end up with either:  
> c:\share\DepartmentName-00-22-64-F4-8E-0C.TIF  
> OR  
> \SomeOtherServer\share\DepartmentName-00-22-64-F4-8E-0C.TIF  
>   
> So the appending of additional text to the file’s name while incorporating the original file name is what I am after. (Not looking to add a date.)  
>   
> I’ve played a bit with rename-item and Move-item, but I’m missing something because neither of these like the use of wildcards or more likely I am misusing wildcard characters.

by MasterOfTheHat at 2013-03-19 09:12:08

> You can do both the rename and the move using Move-Item:  
> `Get-ChildItem C:\temp\test2\00-22-64-F4-8E-0C.TIF | ForEach-Object { Move-Item -Path $.FullName -Destination "c:\temp\test\DepartmentName-$($.Name)" }`

by Lahru at 2013-03-19 09:59:04

> Theank you very much, was able to use this with only a minor adjustment to deal with all files in the originating folder, like so  
> `Get-ChildItem C:\temp\test2\ | ForEach-Object { Move-Item -Path $.FullName -Destination "c:\temp\test\DepartmentName-$($.Name)" }`

---

<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:58pm UTC](https://forums.powershell.org/t/appending-the-filename/740/2 "2024-05-16T20:58:13Z")

</div>

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


