Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Video youtube
- https://youtu.be/zeanmjRKnFg
- *****************************************************
- CODICE
- *****************************************************
- Get-ChildItem -Directory -Path ??* |
- Move-Item -Destination {
- # Determine the target dir - the input dir's first letter -
- # ensure that it exists, and output it.
- New-Item -Type Directory -Force (Join-Path $_.Parent.FullName $_.Name[0])
- }
- *****************************************************
- BATCH EQUIVALENTE
- *****************************************************
- @echo off
- setlocal EnableExtensions DisableDelayedExpansion
- %SystemRoot%\System32\tree.com
- for /F "eol=| delims=" %%I in ('dir /AD /B 2^>nul') do (
- set "FolderName=%%I"
- setlocal EnableDelayedExpansion
- set "TargetFolder=!FolderName:~0,1!"
- if not "!TargetFolder!" == "!FolderName!" (
- md "!TargetFolder!" 2>nul
- move /-Y "!FolderName!" "!TargetFolder!\"
- )
- endlocal
- )
- %SystemRoot%\System32\tree.com
- endlocal
Add Comment
Please, Sign In to add comment