• Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Renaming software with txt script

Joined
Sep 18, 2017
Messages
33 (0.02/day)
System Name "I want upgrade"
Processor i5 3570k
Motherboard Asrock z77 Extreme 4
Cooling Gammaxx 400
Memory Corsair Vengeace 2x4gb 2133Mhz
Video Card(s) Sapphire RX 580 Pulse 8gb
Storage Kingston HyperX 128gb, WD Blue 2TB
Display(s) Chimei 24LH
Case Thermaltake Commander MS-1 Snow
Power Supply Corsair GS600
Mouse Standard cheap usb mice
Keyboard Standard cheap usb keyboard
I have 2000 folders with the data inside, inside each folder there is a text file contain the main info like name, year, city, etc.
So I was wondering, I would like to rename those 2000 folders based on the txt inside to [year]-city-name to make my work easier. The original folder names are just sequential number 3101 and so on
Can anyone help me with it?
 
Joined
Aug 26, 2019
Messages
188 (0.25/day)
This may not be the hand holding you're looking for, but here's a quick example in Bash of how you can take a match and apply it to a name. What I'm doing here is taking .flac files on my NAS (that's my pwd when running the below) and transcoding them to mp3 onto my mp3 player.

for file in *.flac; do flac -cd "$file" | lame -q 0 -V0 - "/media/Cowan/Music/An Awesome CD/${file%.flac}.mp3"; done
 

W1zzard

Administrator
Staff member
Joined
May 14, 2004
Messages
22,783 (3.60/day)
Processor Core i7-8700K
Memory 32 GB
Video Card(s) RTX 3080
Display(s) 30" 2560x1600 + 19" 1280x1024
Software Windows 10 64-bit
I suspect OP is on Windows, so probably doesn't have access to bash
 
Joined
Sep 18, 2017
Messages
33 (0.02/day)
System Name "I want upgrade"
Processor i5 3570k
Motherboard Asrock z77 Extreme 4
Cooling Gammaxx 400
Memory Corsair Vengeace 2x4gb 2133Mhz
Video Card(s) Sapphire RX 580 Pulse 8gb
Storage Kingston HyperX 128gb, WD Blue 2TB
Display(s) Chimei 24LH
Case Thermaltake Commander MS-1 Snow
Power Supply Corsair GS600
Mouse Standard cheap usb mice
Keyboard Standard cheap usb keyboard
NVM guys. I did them manually with my fingers. My left pinky and index fingers were sore with that thousands CTRL C+V.
Told the survey guys to rename the folders like that so I don't have to do this anymore with the next batch.
 

Aiden_

New Member
Joined
Feb 4, 2021
Messages
13 (0.06/day)
Definitely too late now, but if this happens again, maybe try a Python script - would probably take 10-15 mins to get something working and then minutes for it to get the job done.
 
Last edited by a moderator:
Joined
Aug 26, 2019
Messages
188 (0.25/day)
@remunramu I'm not sure where you're at in your career or if you're even in the IT world, but it would be worth investing even a modicum of time into python/powershell/bash/whatever. Not giving you grief, and as posted above also not willing to code for you, but hopefully this is positive peer pressure to somewhat familiarize yourself with a bit of scripting. :)
 
Top