Extracting data From File Name

I would be grateful for any help on a problem I have. This entails extracting data from files names and inserting it into an Excel file. Not wishing to reinvent the wheel I have searched, but without success, for how this could be achieved.

Basically, I have a directory full of MP3 files. What I need is a script which will go through each of the files in the directory and extract the 3 parts of the file name together with the extension and save all these to a comma delimited csv file. The next bit I can do as it is straightforward as it involves just importing this csv file into Excel.

Each file name has the same format ie it has 3 sections separated by a hyphen and a tilde (alway in the same order) eg:
Blue Murder - The Screaming Habdabs ~ 1975 Lossiemouth Live In The Hanger.mp3

I need to save the data from each file in a csv file as:
Blue Murder,The Screaming Habdads,1975 Lossiemouth Live In The Hanger, MP3

I suspect that this will require Regex to achieve and that is probably beyond me!

Thank you for any help you can offer
 

My Computer

The problem is that a .csv is a database file. I think what you need to do is strip the extension from the file names and then import those names into a database table using a database program which can export to Excel. I've posed the question about this in a database forum and will let you know what I find.
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Keyboard
    Logitech MX 3200
    Mouse
    Logitech MX 600
    Internet Speed
    30 Mbps

My Computer

System One

  • Manufacturer/Model
    HP-Pavilion m9280.uk-a
    CPU
    2.30 gigahertz AMD Phenom 9600 Quad-Core
    Motherboard
    ASUSTek Computer INC. NARRA3 3.02
    Memory
    3582 Megabytes Usable Installed Memory (4 Gig)
    Graphics Card(s)
    ASUS NVIDIA Geforce GTS450
    Sound Card
    Realtek High Definition 7.1 Audio (HP drivers)
    Monitor(s) Displays
    HP w2408 24.0" (Dual monitor)
    Screen Resolution
    1920 * 1200, 1920 * 1200
    Hard Drives
    3*500 Gigabytes Usable Hard Drive Capacity
    Plus 2x USB (160Gig each) external HDD
    BluRay & DVD Weiters
    HL-DT-ST BD-RE GGW-H20L SCSI CdRom (Bluray RW) Device
    AlViDrv BDDVDROM SCSI CdRom (Blueray) Device
    TSSTcorp CDDVDW TS-H653N SCSI CdRom
    Internet Speed
    40 Meg
In addition, you might take a look at this for stripping the extension from a filename- How do I strip off the extension from a file name. When it's done, the file names should be just plain text that you can import into Excel. I don't know if it would be comma delimited.
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Keyboard
    Logitech MX 3200
    Mouse
    Logitech MX 600
    Internet Speed
    30 Mbps
#Lottiemansion,

Had a look at ADC on a few sites. It is old as you say and it doesn't seem to run on Vista. Given the problems I seem to get with Vista for no reason I am reluctant to try it. The last crash was terrible and took me ages to recover and re-install Vista again. Thank you anyway for your response.

#Wither 3
I got a hint for a step from another kind member and eventually resolved it this way:

At CMD prompt ran Dir /b > files.txt
Used replace to substitute commas for all the delimiters
Opened files.txt in Excel
The 4 fields appeared separately in Cols A, B, C, D the latter holding the extension
Problem solved!

Anyway, many thanks for your kind response to my cry for help!
 

My Computer

I'm glad you got it resolved.
 

My Computer

System One

  • Operating System
    Vista Home Premium 64 bit SP2
    Manufacturer/Model
    Cyberpower
    CPU
    Intel Quad CPU Q6700 2.67 GHZ
    Motherboard
    NVIDIA 780i
    Memory
    4 GB
    Graphics Card(s)
    MSI GTX 560 TI Twin Frozr
    Sound Card
    Sound Blaster SB Audigy
    Monitor(s) Displays
    Viewsonic VG2436
    Screen Resolution
    1920x1080p
    Hard Drives
    Samsung HD 105SI
    WDC WD20
    Case
    Apevia XJupiter
    Cooling
    air
    Keyboard
    Logitech MX 3200
    Mouse
    Logitech MX 600
    Internet Speed
    30 Mbps
Back
Top