Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. $sourcePath = 'C:\Users\steve\Desktop\New folder'
  2.  
  3. Get-Childitem $sourcePath -File | Foreach-Object `
  4. {
  5. $target = -join($sourcePath,"\", $_.FullName.Substring($_.FullName.LastIndexOf("."), $_.FullName.Length - $_.FullName.LastIndexOf(".")).Substring(1))
  6. echo $target
  7. mkdir $target
  8. cd $sourcePath
  9. Move-Item $_ -Destination $target
  10. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement