Torna indietro   Hardware Upgrade Forum > Software > Microsoft Windows > Microsoft Windows 11

Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria
vivo X300 Pro rappresenta un'evoluzione misurata della serie fotografica del produttore cinese, con un sistema di fotocamere migliorato, chipset Dimensity 9500 di ultima generazione e l'arrivo dell'interfaccia OriginOS 6 anche sui modelli internazionali. La scelta di limitare la batteria a 5.440mAh nel mercato europeo, rispetto ai 6.510mAh disponibili altrove, fa storcere un po' il naso
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo
Lenovo Legion Go 2 è la nuova handheld PC gaming con processore AMD Ryzen Z2 Extreme (8 core Zen 5/5c, GPU RDNA 3.5 16 CU) e schermo OLED 8,8" 1920x1200 144Hz. È dotata anche di controller rimovibili TrueStrike con joystick Hall effect e una batteria da 74Wh. Rispetto al dispositivo che l'ha preceduta, migliora ergonomia e prestazioni a basse risoluzioni, ma pesa 920g e costa 1.299€ nella configurazione con 32GB RAM/1TB SSD e Z2 Extreme
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti
A re:Invent 2025, AWS mostra un’evoluzione profonda della propria strategia: l’IA diventa una piattaforma di servizi sempre più pronta all’uso, con agenti e modelli preconfigurati che accelerano lo sviluppo, mentre il cloud resta la base imprescindibile per governare dati, complessità e lock-in in uno scenario sempre più orientato all’hybrid cloud
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 29-10-2024, 10:08   #1
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
RICHIESTA DI UN COMANDO PER POWERSHELL

Ciao a tutti ho un quesito: siccome ho circa 4/5cento di GB di musica vorrei sistemarla, avrei bisogno di un COMANDO per powershell che scansioni la cartella dove tengo la musica e mi permetta di: prendere tutte le cartelle che contengono i file .mp3 spostandole in un’ altra cartella eliminando i file .mp3 al suo interno ma mantenendo nome e “albero” delle sopracartelle, cioè : se ad esempio la cartella che contiene i file .mp3 si chiama CD2 contenuta all’interno di MUSICA>nome artista>titolo album>CD2, il risultato finale sarà una cartella chiamata MUSICA1 con all’interno tutte le sotto cartelle vuote. E’ possibile? Grazie
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 10:22   #2
pps
Senior Member
 
L'Avatar di pps
 
Iscritto dal: Oct 2002
Città: Vicino a un ponte
Messaggi: 1293
Quote:
Originariamente inviato da pistorius08 Guarda i messaggi
Ciao a tutti ho un quesito: siccome ho circa 4/5cento di GB di musica vorrei sistemarla, avrei bisogno di un COMANDO per powershell che scansioni la cartella dove tengo la musica e mi permetta di: prendere tutte le cartelle che contengono i file .mp3 spostandole in un’ altra cartella eliminando i file .mp3 al suo interno ma mantenendo nome e “albero” delle sopracartelle, cioè : se ad esempio la cartella che contiene i file .mp3 si chiama CD2 contenuta all’interno di MUSICA>nome artista>titolo album>CD2, il risultato finale sarà una cartella chiamata MUSICA1 con all’interno tutte le sotto cartelle vuote. E’ possibile? Grazie
Prova con questo, copia e incolla il codice e salva come .Ps1.
NOTA BENE
ho scritto il codice "al volo" e non l'ho testato, quindi prima di metterlo "in produzione" creati due cartelle di "origine" e "destinazione" e fai una prova.
(non voglio averti sulla coscenza)
P.S. modifica "al bisogno" i percorsi di source e destination delle prime due righe.
Aggiornami se funziona / va bene cosi / dobbiamo fare delle modifiche...
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"

# Ottieni tutte le cartelle che contengono file .mp3
$foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {
    Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
}

# Sposta le cartelle nella nuova posizione e elimina i file .mp3
foreach ($folder in $foldersWithMp3) {
    $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
    New-Item -ItemType Directory -Path $newFolderPath -Force
    Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force
}
__________________
ASUS PRIME Z490-P | Intel® i7 10700K | Asus GeForce GTX 4060 OC | CORSAIR Vengeance LPX DDR4 3000 -32Gb- | Samsung 970 PRO M.2 512 Gb | Samsung SSD 840 PRO 256 Gb | 2x Samsung 970 EVO PLUS M.2 1 Tb

Ultima modifica di pps : 29-10-2024 alle 10:24.
pps è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 11:49   #3
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Dovrebbe funzionare anche qualcosa di più semplice come:
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"
Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
Nella cartella di destinazione verranno esclusi solo i file MP3; se ci sono immagini, copertine o altro, saranno copiate (per non copiarle basta aggiungere la loro estensione a -Exclude).
Nei test rapidi che ho fatto, il codice funziona come previsto, ma resta valido il consiglio di fare prima qualche prova con qualche tua "cartella cavia".
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 15:17   #4
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Risposta al primo codice @pps

Codice:
Microsoft Windows [Versione 10.0.26100.2161]
(c) Microsoft Corporation. Tutti i diritti riservati.

C:\Users\umber>$sourcePath = "C:\Users\umber\Music\1-da sistemare"
"$sourcePath" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>$destinationPath = "C:\Users\umber\Music\MUSICA1"
"$destinationPath" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber># Ottieni tutte le cartelle che contengono file .mp3
"#" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>$foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0}
"$foldersWithMp3" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber># Sposta le cartelle nella nuova posizione e elimina i file .mp3
"#" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>foreach ($folder in $foldersWithMp3) {
"foreach" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>    $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
"$newFolderPath" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>    New-Item -ItemType Directory -Path $newFolderPath -Force
"New-Item" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>    Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force}
"Remove-Item" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
risposta al secondo codice @SysLack

Codice:
Microsoft Windows [Versione 10.0.26100.2161]
(c) Microsoft Corporation. Tutti i diritti riservati.

C:\Users\umber>$sourcePath = "C:\Users\umber\Music\1-da sistemare"
"$sourcePath" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>$destinationPath = "C:\Users\umber\Music\MUSICA1"
"$destinationPath" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.

C:\Users\umber>Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
"Copy-Item" non è riconosciuto come comando interno o esterno,
 un programma eseguibile o un file batch.
Grazie per il vostro interessamento. Umberto
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2

Ultima modifica di pistorius08 : 29-10-2024 alle 15:23.
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 15:22   #5
Nicodemo Timoteo Taddeo
Senior Member
 
L'Avatar di Nicodemo Timoteo Taddeo
 
Iscritto dal: Mar 2008
Messaggi: 20626
Stai operando dal prompt dei comandi non da Power Shell, o sbaglio?
Nicodemo Timoteo Taddeo è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 16:12   #6
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Se vuoi usarlo come codice direttamente dal terminale, quindi senza fare copia-codice/incolla-su-file-di-testo/salva-come-PS1 (come suggerito da pps), allora devi avviare PowerShell (tasto destro su menu start / Windows PowerShell), incollare questo codice e poi modificare i percorsi prima di premere invio:
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica" ; $destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1" ; Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"

Con Windows 11 la procedura è la medesima.
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 16:14   #7
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Ops hai ragione pensavo fosse la stessa cosa
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 16:21   #8
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Quote:
Originariamente inviato da SysLack Guarda i messaggi
Dovrebbe funzionare anche qualcosa di più semplice come:
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"
Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
Nella cartella di destinazione verranno esclusi solo i file MP3; se ci sono immagini, copertine o altro, saranno copiate (per non copiarle basta aggiungere la loro estensione a -Exclude).
Nei test rapidi che ho fatto, il codice funziona come previsto, ma resta valido il consiglio di fare prima qualche prova con qualche tua "cartella cavia".
Ho provato da powershell ma non ha funzionato, in pratica ha copiato tutte le cartelle della "sorgente" in quella di destinazione, compresi tutti i file FLAC , l'operazione non è finita per mancanza di spazio, non so se gli mp3 sono stati eliminati.....adesso controllo
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 16:34   #9
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
@pps
[QUOTE
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"

# Ottieni tutte le cartelle che contengono file .mp3
$foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {
    Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
}

# Sposta le cartelle nella nuova posizione e elimina i file .mp3
foreach ($folder in $foldersWithMp3) {
    $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
    New-Item -ItemType Directory -Path $newFolderPath -Force
    Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force
}
[/quote]

Codice:
PowerShell 7.4.6

Do you want to run software from this untrusted publisher?
File C:\users\umber\0-portable\powershell-7.4.6-win-x64\Modules\PSReadLine\PSReadLine.format.ps1xml is published by
CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US and is not trusted on your system.
Only run scripts from trusted publishers.
[V] Never run  [D] Do not run  [R] Run once  [A] Always run  [?] Help (default is "D"): d
Cannot load PSReadline module.  Console is running without PSReadline.
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> $sourcePath = "C:\Users\umber\Music\1-da sistemare"
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> $destinationPath = "C:\Users\umber\Music\MUSICA1"
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> # Ottieni tutte le cartelle che contengono file .mp3
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> $foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0}
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
Select-Object: A parameter cannot be found that matches parameter name 'eq'.
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> # Sposta le cartelle nella nuova posizione e elimina i file .mp3
PS C:\Users\umber\0-PORTABLE\PowerShell-7.4.6-win-x64> foreach ($folder in $foldersWithMp3) {
>>     $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
>>     New-Item -ItemType Directory -Path $newFolderPath -Force
>>     Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force}
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2

Ultima modifica di pistorius08 : 29-10-2024 alle 16:38.
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 16:51   #10
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Quote:
Originariamente inviato da pistorius08 Guarda i messaggi
Ho provato da powershell ma non ha funzionato, in pratica ha copiato tutte le cartelle della "sorgente" in quella di destinazione, compresi tutti i file FLAC , l'operazione non è finita per mancanza di spazio, non so se gli mp3 sono stati eliminati.....adesso controllo
Lo scopo non era forse copiare le cartelle mantenendo l'albero delle sottocartelle, eliminando tutti gli MP3? Se vuoi eliminare anche i .flac, devi modificare la fine del codice con:
Codice:
-Exclude "*.mp3","*.flac"
Al bisogno, puoi aggiungere anche altre estensioni, oppure essere più drastico ed eliminare ogni file (se non ti ricordi tutti i tipi di file presenti), con
Codice:
-Exclude "*.*"
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 17:34   #11
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
@SysLack
il tuo comando funziona quasi alla perfezione, ho provato con un album che sapevo contenesse mp3, il risultato è la nuova cartella senza gli mp3 con all'interno le 3 cartelle originali, CD1 CD2 contenenti le immagini di artist front back disc, la terza cartella cover con all'interno le vari immagini e il pdf dell'album fino qua tutto bene, ma non ha eliminato/spostato la cartella sorgente che è rimasta immutata, in conclusione: il tuo comando copia tutte le cartelle della sorgente contenenti mp3 e FLAC svuotando gli mp3 nella destinazione , mentre a me occorrerebbe che le cartelle dei FLAC non vengano copiate mentre quelle degli mp3 vengano svuotate dagli mp3 e tagliate/incollate nella cartella di destinazione, penso proprio che se la cosa si possa fare di sicuro tu troverai la soluzione
GRAZIE GRAZIE GRAZIE
P.S. Sono migliaia di cartelle non mi ricordo quali siano quelle contenenti gli mp3......e non voglio copiare nulla perchè non avrei abbastanza spazio visto che sono 4/500 GB di "roba" se poi le copia tutte il nr raddoppia....e le cartelle che contengono gli mp3 restano immutate al loro posto, e io vorrei che queto non succedesse. Scusami tanto se ti stò facendo tribulare. Umberto
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2

Ultima modifica di pistorius08 : 29-10-2024 alle 17:55.
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 20:51   #12
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Quote:
Originariamente inviato da pps Guarda i messaggi
Prova con questo, copia e incolla il codice e salva come .Ps1.
NOTA BENE
ho scritto il codice "al volo" e non l'ho testato, quindi prima di metterlo "in produzione" creati due cartelle di "origine" e "destinazione" e fai una prova.
(non voglio averti sulla coscenza)
P.S. modifica "al bisogno" i percorsi di source e destination delle prime due righe.
Aggiornami se funziona / va bene cosi / dobbiamo fare delle modifiche...
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"

# Ottieni tutte le cartelle che contengono file .mp3
$foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {
    Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
}

# Sposta le cartelle nella nuova posizione e elimina i file .mp3
foreach ($folder in $foldersWithMp3) {
    $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
    New-Item -ItemType Directory -Path $newFolderPath -Force
    Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force
}
Questo il risultato ma sembra non aver fatto nulla

Quote:
PowerShell 7.3.8


PS C:\Users\umber\Music\prova mp3.1> $sourcePath = "C:\Users\umber\Music\prova mp3.1\MUSICA"
PS C:\Users\umber\Music\prova mp3.1> $destinationPath "C:\Users\umber\Music\prova mp3.1\MUSICA1"
ParserError:
Line |
1 | $destinationPath "C:\Users\umber\Music\prova mp3.1\MUSICA1"
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Unexpected token '"C:\Users\umber\Music\prova mp3.1\MUSICA1"' in expression or statement.
PS C:\Users\umber\Music\prova mp3.1>
PS C:\Users\umber\Music\prova mp3.1> # Ottieni tutte le cartelle che contengono file .mp3
PS C:\Users\umber\Music\prova mp3.1> $foldersWithMp3 = Get-ChildItem -Path $sourcePath -Recurse -Directory | Where-Object {
>> Get-ChildItem -Path $_.FullName -Filter *.mp3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
>> }
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
Select-Object:
Line |
2 | … p3 -File | Measure-Object | Select-Object -ExpandProperty Count -eq 0
| ~~~
| A parameter cannot be found that matches parameter name 'eq'.
PS C:\Users\umber\Music\prova mp3.1>
PS C:\Users\umber\Music\prova mp3.1> # Sposta le cartelle nella nuova posizione e elimina i file .mp3
PS C:\Users\umber\Music\prova mp3.1> foreach ($folder in $foldersWithMp3) {
>> $newFolderPath = Join-Path -Path $destinationPath -ChildPath $folder.FullName.Substring($sourcePath.Length)
>> New-Item -ItemType Directory -Path $newFolderPath -Force
>> Remove-Item -Path (Join-Path -Path $folder.FullName -ChildPath "*.mp3") -Force
>> }
PS C:\Users\umber\Music\prova mp3.1>
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 29-10-2024, 22:35   #13
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Quote:
Originariamente inviato da SysLack Guarda i messaggi
Dovrebbe funzionare anche qualcosa di più semplice come:
Codice:
$sourcePath = "C:\percorso\alla\tuacartella\musica"
$destinationPath = "C:\percorso\alla\nuovacartella\MUSICA1"
Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
Nella cartella di destinazione verranno esclusi solo i file MP3; se ci sono immagini, copertine o altro, saranno copiate (per non copiarle basta aggiungere la loro estensione a -Exclude).
Nei test rapidi che ho fatto, il codice funziona come previsto, ma resta valido il consiglio di fare prima qualche prova con qualche tua "cartella cavia".
Codice:
PowerShell 7.3.8

PS C:\Users\umber\Music\prova mp3.1> $sourcePath = "C:\Users\umber\Music\prova mp3.1\MUSICA"
PS C:\Users\umber\Music\prova mp3.1> $destinationPath = "C:\Users\umber\Music\prova mp3.1\MUSICA1"
PS C:\Users\umber\Music\prova mp3.1> Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
Ho riprovato con una cartella piu corposa Per funzionare funziona ma copia anche le cartelle con i FLAC, ed avendo la cartella MUSICA di 568 GB non ho abbastanza spazio per svolgere l'operazione, l'ideale sarebbe avere come risultato finale solo le cartelle relative agli mp3 vuote e non ma penso che non si possa fare (spero di sbagliarmi). Ho pensato pure di prendere a blocchi le cartelle spostarle in un'altra cartella fare le operazioni ma sarei a punto e accapo perchè dovrei "spulciarle" una ad una per capire quali sono le cartelle con gli mp3, prendere quelle con i FLAC e rispostarle nella cartella originale (MUSICA) e poi perderei le personalizzazioni di tutte le cartelle che ho tipo queste



Mi sembra un po come il cane che si morde la coda, sto pensando di abbandonare la mia malsana idea anche se la speranza è l'ultima a morire. Grazie Mille per il tempo dedicatomi
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2

Ultima modifica di pistorius08 : 29-10-2024 alle 22:41.
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 09:44   #14
pps
Senior Member
 
L'Avatar di pps
 
Iscritto dal: Oct 2002
Città: Vicino a un ponte
Messaggi: 1293
Quote:
Originariamente inviato da pistorius08 Guarda i messaggi
Codice:
PowerShell 7.3.8

PS C:\Users\umber\Music\prova mp3.1> $sourcePath = "C:\Users\umber\Music\prova mp3.1\MUSICA"
PS C:\Users\umber\Music\prova mp3.1> $destinationPath = "C:\Users\umber\Music\prova mp3.1\MUSICA1"
PS C:\Users\umber\Music\prova mp3.1> Copy-Item $sourcePath $destinationPath -Recurse -Exclude "*.mp3"
Ho riprovato con una cartella piu corposa Per funzionare funziona ma copia anche le cartelle con i FLAC, ed avendo la cartella MUSICA di 568 GB non ho abbastanza spazio per svolgere l'operazione, l'ideale sarebbe avere come risultato finale solo le cartelle relative agli mp3 vuote e non ma penso che non si possa fare (spero di sbagliarmi). Ho pensato pure di prendere a blocchi le cartelle spostarle in un'altra cartella fare le operazioni ma sarei a punto e accapo perchè dovrei "spulciarle" una ad una per capire quali sono le cartelle con gli mp3, prendere quelle con i FLAC e rispostarle nella cartella originale (MUSICA) e poi perderei le personalizzazioni di tutte le cartelle che ho tipo queste



Mi sembra un po come il cane che si morde la coda, sto pensando di abbandonare la mia malsana idea anche se la speranza è l'ultima a morire. Grazie Mille per il tempo dedicatomi
...mi sà che devo fare un pò di DEBUG...
__________________
ASUS PRIME Z490-P | Intel® i7 10700K | Asus GeForce GTX 4060 OC | CORSAIR Vengeance LPX DDR4 3000 -32Gb- | Samsung 970 PRO M.2 512 Gb | Samsung SSD 840 PRO 256 Gb | 2x Samsung 970 EVO PLUS M.2 1 Tb
pps è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 11:47   #15
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Quote:
Originariamente inviato da pistorius08 Guarda i messaggi
a me occorrerebbe che le cartelle dei FLAC non vengano copiate mentre quelle degli mp3 vengano svuotate dagli mp3 e tagliate/incollate nella cartella di destinazione
Questo codice va copiato su un file di testo (Blocco Note), modificato con i percorsi giusti ($Sorgente e $Destinazione), salvato con estensione .PS1 e lanciato con PowerShell (tasto destro sul file e "Esegui con PowerShell"). Non fare copia e incolla direttamente sul terminale. Se il file PS1 non viene eseguito, apri PowerShell ed esegui il comando
Codice:
powershell.exe -ep bypass C:\percorso file.PS1
Dovrebbe fare esattamente ciò che intendi, ma è da considerare che i file MP3 saranno cancellati e quindi non li avrai più né sulla cartella sorgente né in quella di destinazione (è quello che volevi, giusto?).
Fai dei test con una copia di alcune cartelle che vuoi spostare, così se qualcosa va storto, non perdi nulla. Considera inoltre che lo script cancellerà tutte le cartelle vuote che trova nella cartella sorgente.
Chiaramente valuta bene se è il caso di lanciare uno script che sposta e cancella file che non potrai più recuperare; ho fatto delle prove e sembra funzionare come desideri, ma onestamente non lo userei su file importanti di cui non ho il backup o che non posso recuperare in altro modo.

Codice:
# Funzione per gestire percorso sottocartelle nella destinazione
function SubPath {
    param (
        [string]$BasePath,
        [string]$FullPath
    )
    $BasePath = (Resolve-Path $BasePath).Path
    $FullPath = (Resolve-Path $FullPath).Path
    if (-not $BasePath.EndsWith('\')) {
        $BasePath += '\'
    }
    if ($FullPath.StartsWith($BasePath)) {
        return $FullPath.Substring($BasePath.Length)
    } else {
        return $FullPath
    }
}


# Percorso cartelle DA MODIFICARE
$Sorgente = "C:\sorgente..."
$Destinazione = "C:\destinazione..."

# Estensione da rimuovere
$Estensione = "*.mp3"

# Individuazione sottocartelle
$SubFolders = Get-ChildItem -Path $Sorgente -Directory -Recurse

# Spostamento cartelle e rimozione MP3
foreach ($Folder in $SubFolders) {
    # Individuazione cartelle da processare
    if (Get-ChildItem -Path $Folder.FullName -Filter $Estensione -File -Recurse) {
        # Creazione nuove cartelle nella destinazione
        $DiffName = SubPath -BasePath $Sorgente -FullPath $Folder.FullName
        New-Item -ItemType Directory "$(Join-Path -Path $Destinazione -ChildPath $DiffName)"
        # Spostamento cartelle contenenti MP3
        $NewPath = "$(Join-Path -Path $Destinazione -ChildPath $DiffName)"
        Move-Item -Path "$($Folder.FullName)\*.*" -Destination $NewPath
        # Rimozione MP3
        Get-ChildItem -Path $NewPath -Filter $Estensione -File | Remove-Item -Force
    }
}

# Cancellazione cartelle vuote nella sorgente
foreach ($DirEmpty in (Get-ChildItem $Sorgente -Recurse -Exclude *.*)) {
    if ((Get-ChildItem $DirEmpty) -eq $null) {
        Remove-Item $DirEmpty -Force
    }
}
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 14:51   #16
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509
Quote:
Originariamente inviato da SysLack Guarda i messaggi
Questo codice va copiato su un file di testo (Blocco Note), modificato con i percorsi giusti ($Sorgente e $Destinazione), salvato con estensione .PS1 e lanciato con PowerShell (tasto destro sul file e "Esegui con PowerShell"). Non fare copia e incolla direttamente sul terminale. Se il file PS1 non viene eseguito, apri PowerShell ed esegui il comando
Codice:
powershell.exe -ep bypass C:\percorso file.PS1
Dovrebbe fare esattamente ciò che intendi, ma è da considerare che i file MP3 saranno cancellati e quindi non li avrai più né sulla cartella sorgente né in quella di destinazione (è quello che volevi, giusto?).
Fai dei test con una copia di alcune cartelle che vuoi spostare, così se qualcosa va storto, non perdi nulla. Considera inoltre che lo script cancellerà tutte le cartelle vuote che trova nella cartella sorgente.
Chiaramente valuta bene se è il caso di lanciare uno script che sposta e cancella file che non potrai più recuperare; ho fatto delle prove e sembra funzionare come desideri, ma onestamente non lo userei su file importanti di cui non ho il backup o che non posso recuperare in altro modo.
RISULTATO SCRIPT

ORIGINE (SITUAZIONE ORIGINE) DESTINAZIONE

cartella solo mp3 (cartella eliminata) cartella vuota
cartella mp3+immagini (cartella eliminata) cartella solo immagini
cartella mp3+immagini+cartella (cartella con cartella) cartella solo immagini
cartella mp3+FLAC+immagini+cartella (cartella con cartella) cartella FLAC+immagini
cartella cartelle (mp3+immagini)-- (cartella vuota) cartella cartelle (immagini)--
cartella cartelle (mp3)-- (cartella vuota) cartella cartelle (vuote)
cartella solo FLAC (cartella solo FLAC) inesistente

Se non è abbastanza chiaro forse qui lo è
https://drive.google.com/file/d/1DM5...usp=drive_link

sembra funzionare anche se c'è da lavorare (io) ancora un pò: per spulciare il tutto eliminare. spostare le cartelle ma è già un'OTTIMO risultato
Un' IMMENNSO GRAZIE Syslcak sei un
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 16:50   #17
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Bene, mi sembra di capire che lo script funzioni adeguatamente (il link google non è pubblico, non si apre senza account, ma mi fido del tuo verdetto). Se ci sono altre esigenze, si può provare anche a perfezionare il codice o aggiungere altre funzioni (se non sono faccende troppo complesse per me).
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 18:44   #18
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Quote:
Originariamente inviato da pistorius08 Guarda i messaggi
cartella mp3+FLAC+immagini+cartella (cartella con cartella) cartella FLAC+immagini
Se interpreto bene, c'è nella sorgente almeno una cartella che contiene sia MP3 che FLAC, per cui quando tale cartella viene spostata vengono inviati anche i FLAC nella cartella di destinazione, che non è ciò che vorresti (giusto?). Per evitare che i FLAC vengano spostati nella cartella di destinazione, puoi aggiungere una riga di codice, così da ottenere:
Codice:
...
# Spostamento cartelle contenenti MP3
$NewPath = "$(Join-Path -Path $Destinazione -ChildPath $DiffName)"
Move-Item -Path "$($Folder.FullName)\*.*" -Exclude "*.flac" -Destination $NewPath -ErrorAction Ignore # Preservazione file FLAC
# Rimozione MP3
Get-ChildItem -Path $NewPath -Filter $Estensione -File | Remove-Item -Force
...
Se poi desideri eliminare tutte le eventuali cartelle vuote anche nella cartella di destinazione, allora basta aggiungere questo alla fine dello script:
Codice:
# Cancellazione cartelle vuote nella destinazione
foreach ($DirEmpty2 in (Get-ChildItem $Destinazione -Recurse -Exclude *.*)) {
    if ((Get-ChildItem $DirEmpty2) -eq $null) {
        Remove-Item $DirEmpty2 -Force
    }
}
Sono delle aggiunte, quindi per tornare indietro al funzionamento precedente basta cancellarle.
SysLack è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 20:24   #19
pistorius08
Senior Member
 
L'Avatar di pistorius08
 
Iscritto dal: Dec 2009
Città: Camunia Valley
Messaggi: 509


Quello dei FLAC + mp3 è l'unica cartella che avevo... era il brano "IL MARINAIO" (già recuperato in FLAC). ascoltalo https://www.youtube.com/watch?v=W_96mcW9qtI ma non scandalizzarti LOL. della Vanoni inserito da me nella cartella (album) "ORNELLA &...." esatto era L'UNICO. NON voglio eliminare le cartella vuote in destinazione perchè è la lista degli album che devo recuperare in FLAC. Per me va bene cosi perchè posso dargli in "pasto", alllo SCRIPT tutta la Cartella MUSICA senza avere problemi di "spazio", perchè l'mp3 ha un peso irrisorio: calcola che un brano in mp3 di media è 3 MB mentre in FLAC potrebbe arrivare senza problemi a una 40ina di MB e di album in mp3 ne ho relativamete pochi
SysLack SEI UN MITO GRAZIE GRAZIE GRAZIE Umberto
__________________
!!!!!!!!!!!Alegher Alegher che 'l bùs del cùl le negher!!!!!!!!!! Alcuni Miei Desktop
Quanta NLCB
16" Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz 16GB DDR4 1330MHz Intel UHD Graphics (Comet Lake-H GT2) [R1] [Quanta Computer] + NVIDIA GeForce RTX2070 8GB GDDR6 1410 SSD Enmotus F200-1600(1,6TB) Windows 11 Home x64 24H2
pistorius08 è offline   Rispondi citando il messaggio o parte di esso
Old 30-10-2024, 21:47   #20
SysLack
Member
 
Iscritto dal: Feb 2024
Messaggi: 135
Grazie a te per il riscontro; l'importante è aver raggiunto l'obiettivo (e aver ripassato un po' di PowerShell); chissà che un domani lo script non serva anche ad altri.
SysLack è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Recensione vivo X300 Pro: è ancora lui il re della fotografia mobile, peccato per la batteria Recensione vivo X300 Pro: è ancora lui il...
Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'' per spingere gli handheld gaming PC al massimo Lenovo Legion Go 2: Ryzen Z2 Extreme e OLED 8,8'...
AWS re:Invent 2025: inizia l'era dell'AI-as-a-Service con al centro gli agenti AWS re:Invent 2025: inizia l'era dell'AI-as-a-Se...
Cos'è la bolla dell'IA e perché se ne parla Cos'è la bolla dell'IA e perché se...
BOOX Palma 2 Pro in prova: l'e-reader diventa a colori, e davvero tascabile BOOX Palma 2 Pro in prova: l'e-reader diventa a ...
iPhone Fold: scorte limitate al lancio m...
OpenAI porterà la pubblicità in ChatGPT ...
TSMC aumenterà ancora i prezzi: nel 2026...
Marvel pubblica anche il secondo teaser ...
Nuovo accordo tra xAI e il Pentagono: l'...
La famiglia Xiaomi 17 sta per registrare...
Nuove auto elettriche che vedremo sul me...
E-bike illegali, a Verona il più ...
Quali sono i giochi più venduti su Steam...
HONOR sta per lanciare un nuovo smartpho...
Jared Isaacman sarà alla guida de...
Il Tesla Cybertruck non arriverà ...
Xiaomi Watch 5 è ufficiale: architettura...
CD Projekt vende GOG: il co-fondatore Mi...
Il meglio di Amazon in 26 prodotti, aggi...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 21:47.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Served by www3v