Getting back file names?

This is a discussion on Getting back file names? within the Tech Board forums, part of the Community Boards category; Hello there, I am new to this forum and I have a problem that i hope i can find a ...

  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    1

    Getting back file names?

    Hello there,
    I am new to this forum and I have a problem that i hope i can find a solution for in here.

    The database for an E-Filing software crashed, I was able to retrieve all the files back, but not in the structure they were in (Cabinets, Drawers, etc.. )

    The files are PDFs. They were named in the format of a five digit number, which represents the invoice number (invoices are scanned, saved as PDFs, filed into the program, each document is named by the invoice # itself is)

    I found the files in memory in a specific format that the E-Filing software uses. I used a conversion tool provided by the software vendor to convert them back to PDFs.
    After i retrieved the PDFs, all files were renamed. Now they have a new 8 digit name that is totally different than the original name. The conversion tool provided an Excel sheet that has the old name and the new name in two columns.

    My question is, is it possible to write code (please suggest a language) to read the "new name" from the excel sheet, look it up in the retrieved files, and rename that file with the "old name". I would do it manually, but i have 10989 files :S

    Any help is appreciated.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,337
    Use excel to do File->Save As... and choose a text file format like .csv
    Those are very simple to read.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,138
    To me this sounds like a job for a batch file/shellscript.

    In Windows, the command is called RENAME.

    You need a text file that is structured like

    RENAME oldfile newfile
    RENAME oldfile newfile
    RENAME oldfile newfile
    RENAME oldfile newfile
    RENAME oldfile newfile
    RENAME oldfile newfile
    .
    .
    .
    RENAME oldfile newfile

    Name the file run.bat and copy it to the directory of your pdfs. Then double click it. It will rename all the files.

    MAKE A BACKUP COPY OF YOUR DIRECTORY FIRST!
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  4. #4
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    In Windows, you can use JScript/VBScript/HTA to solve this kind of problem.

    You can use FileSytemObject ActiveX Object to modifying files and folders.

    Of course you can do some simple parsing for the Excel's clipboard/exported text file.

    If you wanna do it quick and execute it fast I would recomended FBSL (Freestyle Basic Language)

    Somewhat the Microsoft's interpreters are quiet slow.
    Just GET it OFF out my mind!!

  5. #5
    Dr Dipshi++ mike_g's Avatar
    Join Date
    Oct 2006
    Location
    On me hyperplane
    Posts
    1,218
    To me this sounds like a job for a batch file/shellscript.
    While i like a shell for calling command or two, to me, scripting in it seems to be about as intuitive as malbolge.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening empty file causes access violation
    By trevordunstan in forum C Programming
    Replies: 10
    Last Post: 10-21-2008, 11:19 PM
  2. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  3. Can we have vector of vector?
    By ketu1 in forum C++ Programming
    Replies: 24
    Last Post: 01-03-2008, 04:02 AM
  4. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  5. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 12:13 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21