Last active
April 24, 2024 04:23
-
-
Save jcefoli/b77e7f2e8d5bfd005c55 to your computer and use it in GitHub Desktop.
Powershell: Move Files & Folders In Directory Recursively to Another Directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Recursively move all files in C:\SourceDir into C:\Destination | |
Assumes C:\Destination exists already, or there could be problems | |
#> | |
Move-Item -Path "C:\SourceDir\*" -Destination "C:\Destination" |
This was an awesome find! Simplicity at it's finest.
Get-ChildItem 'dot-slash *.(file extension)' -Recurse | Move-Item -Destination 'dot-slash'
I just... I mean I... Thanks you. It was so simple I completely missed it.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ChangBroot Yeah, there was some niche reason why I needed this a long time ago, but I cannot remember. It's not very practical for most use cases, but I think I needed to move files out of a directory quickly without needing to preserve paths or directories.
Most of my gists are a place I dump scripts to remember/reuse/modify them later, so any comments/feedback are welcome, but it doesn't mean that they're a copy/paste solution for everyone. Glad this helped you.