Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 decade ago

I need a program that creates hundreds of .txt files and names them according to a list or folder content.?

Please read below, I'm aware that there a programs out there that make a single txt file of the contents of a folder and show you file names, sizes etc. But I need something extremely different.

OK, this is a bit difficult to understand unless I describe to you what I do.

I have a folder in my computer at work with roughly 900 videos. Each video has a very distinctive name. For example one of them is called "River Plaza Perimeter.mpg", another is called "Glen Avery Axonometric.mpg". And so on and so forth. So what I've been doing in the last week is creating text files with the same names for example River Plaza Perimeter.txt, Glen Avery Axonometric.txt and in those files I write the client's name, phone number, address, products used, staff who took the project and a lot more. The txt files are stored in the same folder and at the end of this whole job, I should have 900 mpg files and 900 txt files with their respective information inside.

What I need is a program that would create blank .txt files with the names of these .mpg files. So I have all 1800 files in the folder and I just go and put all the info inside the txt files. I figured that would save me a lot of time because I have tried copy and paste but I hope there is something out there I can use instead because I will keep needing it in the future.

This is a visual of what I need that folder to look like:

River Plaza Perimeter.mpg

River Plaza Perimeter.txt

Glen Avery Axonometric.mpg

Glen Avery Axonometric.txt

Timothy Default Overlay.mpg

Timothy Default Overlay.txt

Joel Patterson Omni Light.mpg

Joel Patterson Omni Light.txt

Thank you for reading,

8 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    You can do this with a simple batch file:

    @echo off

    for %%f in (*.mpg) DO IF NOT EXIST %%~nf.txt echo %%~nf > %%~nf.txt

    Put those 2 lines in a file with a .bat extension in the same folder as your .mpg files.

    Run it either by clicking on it in explorer, or from a command prompt.

    It will only create files if they don't already exist, so it won't touch any existing files.

    I would try it in a test directory with just a few files first before you run it against the 900, and you really should make sure you have a backup of that directory before you run it there, just to be safe.

  • 1 decade ago

    Okay, I understand the question and have had to do similar things. However, I'm not aware of any program that can do this. Since I'm a programmer I would just write something, I could probably whack it out in an hour or two.

    Barring that, or if I didn't want to take the hour, what I would do is this: In a My Computer/Windows Explorer window, navigate to the appropriate folder. Right click an empty spot (which can be as simple as between icons, or away from the filename in Details view, which is the view I recommend for such a high number of files), click New, and click Text Document. You'll get a a new, empty text document named "New Text Document.txt" and you'll be in naming mode to type the filename. Since this is hardly better, I would just press escape.

    THEN, with the right mouse button I would drag it over (to the same folder, so a fraction of an inch is plenty) to get a menu, and choose Copy Here. You'll get another empty text file named "New Text Document (1).txt". Then select both - Click one and Shift-Click the other - and repeat the Right-Drag method. Now you have 4 empty text files. Click the first, Shift-Click the last and repeat the Right-Drag. Now you have 8 files. etc. etc. etc.

    It'll take a while, but you'll have your 900 empty text files. If you have the Status bar turned on in My Computer/Windows Explorer, highlighting them all will tell you how many you have, down in the status bar.

    NOW. Select the first movie file and press F2. This will get you editing the file name. Highlight the whole filename and press Ctrl-Insert (the Windows version of Copy, works everywhere in Windows, as opposed to Ctrl-C). Press Escape. Then press F2 on one of the Text files. Highlight the whole filename and press Shift-Insert (Windows version of Paste, like Ctrl-V). Press Enter. Now you have an empty text file named after that movie file.

    If you want to use a standard format in the text file, I would recommend adding it to the first empty text file first, before all the copying. Say for example:

    Client's Name:

    Phone Number:

    Address

    Products Used:

    Project Staff:

    That way THIS will save you a load of time with this process, since it will be in every "blank" text file before you fill it out.

  • 1 decade ago

    If you know DOS it will be pretty simple.

    1. Open command prompt and change the directory to the directory of mpgs. (use CD command)

    2. Just list all the files as you want using DIR command (for eg: DIR *.MPG).

    3. Export the result using ">" operator ( for eg: DIR *.MPG > list.txt)

    4. Edit the list.txt as required using find replace in notepad or a better editor.

    If you know DOS pls proceed, otherwise get someone who knows DOS. If you do some mistake you may create a mess. Pls be Cautious.

  • ?
    Lv 7
    1 decade ago

    Karen's directory printer should be able to do this.

    Create a file of names from the folder, rename to *.txt. It might work better to create the list outside of your video folder and move it back when you're done. Do a test run with a filter first to be sure you're getting the effect you want.

    http://www.karenware.com/powertools/ptdirprn.asp

  • How do you think about the answers? You can sign in to vote the answer.
  • 1 decade ago

    I CAN DO THIS. INFACT I HAVE ALREADY DONE THIS. BUT SORRY I CANT SHARE MY CODE FOR FREE WITH ANYONE. But if you paste ur code here, I can try helping you. This is pretty easy.

    At-least let me tell you the logic,

    --automatically detect and create a array of all the file names you want

    for each filename

    {

    create filename.txt

    write output of ffmpeg.exe

    close filename.txt

    }

    done!!

  • 1 decade ago

    perl is the easiest answer, and it could include all of the mpeg metadata if you wanted it.

    You don't say what OS, but if you are Windoze, go with the java program they list here for you.

    perl was made for text files working with the underlying OS.

  • 1 decade ago

    package com.org.folder;

    /*

    * @author Sridhar Reddy

    * @email : sridhar@innoviti.com

    */

    import java.io.File;

    import java.io.IOException;

    import java.util.Scanner;

    public class ReadFilesinFolder {

    /**

    * @param args

    * @throws IOException

    */

    public static void main(String[] args) throws IOException {

    // TODO Auto-generated method stub

    Scanner scan = new Scanner(System.in);

    String filePath = scan.next();

    File file = new File(filePath);

    int count = 0;

    for (File f : file.listFiles()) {

    if (f.isFile()) {

    String fileName = f.getName();

    System.out.println(fileName);

    fileName = fileName.substring(0, fileName.indexOf("."));

    System.out.println(fileName);

    File txtFile = new File(filePath+"/"+fileName+".txt");

    txtFile.createNewFile();

    System.out.println(txtFile);

    count++;

    }

    }

    System.out.println("Number of files: " + count);

    }

    }

    If you face any problems let me know.....

  • 1 decade ago

    just about impossible, because that many files being created at once would CRASH your system, although, if you really need help, you can pay someone to do it ;D

    Im up for grabs lol xD Ill do it for five bucks in a paypal account xD

Still have questions? Get your answers by asking now.