dropbox1349

Ordinare le cartelle in un ordine alfabetico di cartelle

Mar 24th, 2021 (edited)
1,505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Video youtube
  2. https://youtu.be/zeanmjRKnFg
  3. *****************************************************
  4. CODICE
  5. *****************************************************
  6.  
  7. Get-ChildItem -Directory -Path ??* |
  8.   Move-Item -Destination {
  9.     # Determine the target dir - the input dir's first letter -
  10.     # ensure that it exists, and output it.
  11.     New-Item -Type Directory -Force (Join-Path $_.Parent.FullName $_.Name[0])
  12.   }
  13.  
  14. *****************************************************
  15. BATCH EQUIVALENTE
  16. *****************************************************
  17.  
  18. @echo off
  19. setlocal EnableExtensions DisableDelayedExpansion
  20. %SystemRoot%\System32\tree.com
  21. for /F "eol=| delims=" %%I in ('dir /AD /B 2^>nul') do (
  22.     set "FolderName=%%I"
  23.     setlocal EnableDelayedExpansion
  24.     set "TargetFolder=!FolderName:~0,1!"
  25.     if not "!TargetFolder!" == "!FolderName!" (
  26.         md "!TargetFolder!" 2>nul
  27.         move /-Y "!FolderName!" "!TargetFolder!\"
  28.     )
  29.     endlocal
  30. )
  31. %SystemRoot%\System32\tree.com
  32. endlocal
Add Comment
Please, Sign In to add comment