Results 1 to 9 of 9

Thread: Auto Renaming Files

  1. #1
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    497
    Distro
    Kubuntu 12.04 Precise Pangolin

    Auto Renaming Files

    I have just used TestDisk/PhotoRec to Recover some lost files. however they all have meaningless names (e.g. f145686.odt).

    What I want to know is, is there some sort of command or script or software that scan the files looking for some sort of title or header and use that to rename them to restore some meaning to them all save a very tedious task?

    If not perhaps someone reading this has the know how to create such a thing. I'm sure I'm not the only one that would find this useful.
    Ubuntu 16.04 / Linux 18
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.

  2. #2
    Join Date
    Jan 2012
    Beans
    753

    Re: Auto Renaming Files

    I had the same exact problem when I accidentally rm -rf ~/'ed my whole computer. Unfortunately, ext2/3/4 erases the filename at deletion, so even with the correct software there is no way to get the files' original names back.

    The software you used DOES use the header of the file to try and detect it's file type (e.g. f145686.odt is most likely a OpenOffice document, I think). Without extremely advanced (and expensive) FBI/NSA-style recovery, there's no way to recover the names using software. You're only hope is if you have a backup somewhere.

  3. #3
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    497
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Auto Renaming Files

    LOL it was my backup (of two laptops) they were just about to be restored. My wife plugged the external drive into the TV not knowing that TV was going to format it.

    Managed to recover most if not all of the Photo and Home Video (the most important stuff).

    Was a NTFS Drive (TV formatted it to XFS) to by the way.
    Last edited by Jonny87; March 16th, 2013 at 10:24 AM.
    Ubuntu 16.04 / Linux 18
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.

  4. #4
    Join Date
    Jun 2006
    Location
    UK
    Beans
    Hidden!
    Distro
    Ubuntu 22.04 Jammy Jellyfish

    Re: Auto Renaming Files

    Have a look at krename. It has a number of plugins that can be used to batch rename files into something more usable. You might find the jpeg/tiff exif plugin useful for adding exif metadata to filenames of photos, and taglib for tag metadata of mp3 files.
    Ubuntu 20.04 Desktop Guide - Ubuntu 22.04 Desktop Guide - Forum Guide to BBCode - Using BBCode code tags

    Member: Not Canonical Team

    If you need help with your forum account, such as SSO login issues, username changes, etc, the correct place to contact an admin is here. Please do not PM me about these matters unless you have been asked to - unsolicited PMs concerning forum accounts will be ignored.

  5. #5
    Join Date
    Aug 2011
    Location
    52.5° N 6.4° E
    Beans
    6,821
    Distro
    Xubuntu 22.04 Jammy Jellyfish

    Re: Auto Renaming Files

    It may be possible for most file types to get some information that is usable as a file name. You would need separate code for each file type, so that would be a script that determines the file type for each file and then calls some tool to extract a title from the header of that file type, and then uses that title to rename the file. Image formats often store some metadata in the file, which may contain a caption, from pdf and libreoffice writer documents you may be able to extract the title, titles of mp3 files are usually recoverable too. I don't thing there's a solution for all types at the same time, and for text files it will certainly not work.

  6. #6
    Join Date
    Nov 2011
    Location
    /dev/root
    Beans
    Hidden!

    Re: Auto Renaming Files

    Quote Originally Posted by coffeecat View Post
    Have a look at krename. It has a number of plugins that can be used to batch rename files into something more usable. You might find the jpeg/tiff exif plugin useful for adding exif metadata to filenames of photos, and taglib for tag metadata of mp3 files.
    Some file types have embedded information that might contain suitable information for renaming. See this link

    http://www.cgsecurity.org/wiki/After_Using_PhotoRec

  7. #7
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    497
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Auto Renaming Files

    Thanks for the input everyone, I will try the suggest options and get back to you all with how I go on.
    Ubuntu 16.04 / Linux 18
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.

  8. #8
    Join Date
    Mar 2010
    Location
    India
    Beans
    8,116

    Re: Auto Renaming Files

    Quote Originally Posted by Jonny87 View Post
    Thanks for the input everyone, I will try the suggest options and get back to you all with how I go on.
    Instead of dealing with recovered files, try the 'P' key option in testdisk after deeper search (if you haven't already overwritten the drive). It lists the files found on a detected (earlier) filesystem for confirmation purpose, but also gives an option to individually copy them, including recursive copy of directories.

    Unless you have overwritten the data area, it may detect the previously existing NTFS partition on it after "Deeper search". If found, you can either restore the partition itself or recover individual files/folders from it.
    Varun
    Help others by marking threads as [SOLVED], if they are. (See how)
    Wireless Script | Use Code Tags

  9. #9
    Join Date
    Feb 2010
    Location
    QLD, Australia
    Beans
    497
    Distro
    Kubuntu 12.04 Precise Pangolin

    Re: Auto Renaming Files

    Quote Originally Posted by varunendra View Post
    Instead of dealing with recovered files, try the 'P' key option in testdisk after deeper search (if you haven't already overwritten the drive). It lists the files found on a detected (earlier) filesystem for confirmation purpose, but also gives an option to individually copy them, including recursive copy of directories.

    Unless you have overwritten the data area, it may detect the previously existing NTFS partition on it after "Deeper search". If found, you can either restore the partition itself or recover individual files/folders from it.
    Oh OK that's good to know. I have unfortunately over written the drive just last night as I was confident that I had already recovered all that I was going to be able to recover. And it appeared that the Photos were there, but I wish I had known this before. I'll keep it mind next time. Thanks.
    Ubuntu 16.04 / Linux 18
    “To mess up a Linux box, you need to work at it; to mess up your Windows
    box, you just need to work on it”.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •