Tiedostojen uudelleennimeäminen koodilla...

Liittynyt
19.10.2016
Viestejä
46
Tämähän ei ole kovin iso haaste osaavalle, mutta minulle on!

Eli pitäisi korvata koodin pätkällä tietyssä hakemistossa kaikki tiedostot, joissa on piste, välilyönnillä.

Eli esim.

nimi1.nimi2.nimi3.jpg

muotoon

nimi1 nimi2 nimi3.jpg

tämä siis kertaluonteinen homma ja command-promptissa ajettuna
 
Liittynyt
19.08.2018
Viestejä
743
Ei tarvitse välttämättä tehdä edes komentoriviltä.
Renaming multiple files in bulk
If you need to rename multiple files at once using the same name structure, you can use these steps:

  1. Open File Explorer.
  2. Browse to the folder that includes all the files you want to rename.
  3. Select all the files.

    Quick Tip: You can use the Ctrl + A keyboard shortcut to select all the files. You can press and hold the Ctrl key and then click the files you want to rename. Or you can select one file and press and hold the Shift key, and then click the last file to select a range of files.

  4. Press the F2 key to rename it.
  5. Type a new name for the file and press Enter.
Changing file names in bulk on Windows 10
 
Liittynyt
07.05.2019
Viestejä
1
Koodi:
Get-ChildItem -File | ? {$_.BaseName -match '\.'} | % { Rename-Item -Path $_.Name "$($_.BaseName.Replace('.', ' '))$($_.Extension)" -WhatIf }
Tuossa PowerShellillä, aja ko. hakemistossa. -WhatIf lopussa kertoo mitä kunkin tiedoston kohdalla tapahtuisi, poista se viivoineen jos näyttää halutulta. Kannattaa myös backupata ennen kuin ajelee koodinpätkiä netistä, en vastaa kadonneista lomakuvista.
 
Liittynyt
16.10.2016
Viestejä
543
Toi ylläoleva (Seeteufel) esimerkki on aika vaarallinen sillä se kadottaa alkuperäisen nimen ja tekee niistä (1) (2) -muotoisia. Powershellillä ainakin onnistuu näin:
Koodi:
Get-ChildItem -File | % {Rename-Item $_.name "$($_.BaseName -replace '\.',' ')$($_.Extension)" }
PS. Kuuluisi pieniä kysymyksiä -ketjuun.
 
Toggle Sidebar

Statistiikka

Viestiketjut
239 542
Viestejä
4 190 226
Jäsenet
70 765
Uusin jäsen
Railsteri

Hinta.fi

Ylös Bottom