I'm very much a novice at programming on the command line so please forgive me asking for very basic help.

I want to take a folder with very many subfolders, add the subfolders and file names to metadata, and then rename the files. So for example, the first file in the first folder would literally be named F0000001, the next file F0000002 and so on. All the file names are in the format of [author] [year] [title]. From looking at other people's questions, these do seem doable but I don't trust myself to try to construct the command line code based on answers to other people for only components of what I want to do.

Any help someone could provide would be very much appreciated.

EDIT: To Answer Kagan's very questions, Naming method [author] [year] [title] means filenames like Vourvoulias 2012. Ink.

Potential ambiguities are a few files I named after an organization when I should have, at the very least, made it one word and using "et al" when there were multiple authors and "(ed)" or "(eds)" when it was an edited collection. I started my file naming conventions years ago without thinking through programming with it later on.

The vast, vast, vast majority of filenames are ".PDF" with a few ".EPUB" in there as well. I don't need the ".pdf" information as metadata.

re:directories- by the end of this process I'm hoping to have no subfolders left and just have one gigantic folder to plug into Mendeley. The subfolder names would just become tags attached to the files that were previously in those subfolders. So for example, the files in the folder "African Political Economy", would have the tag "African Political Economy", and so on.

Hope that clarifies everything.

  • Are you trying to save all the metadata in a single file/database or create a metadata file for each folder? I am assuming that the new file name is not important as long as the old and the new file name appears correctly in the metadata and the new file name is in the format F#######. And what will happen to the folder names? – FedonKadifeli Jun 20 at 19:28
  • So ultimately I'm going to import the whole database into mendeley, and then import from mendeley into zotero (since only mendeley has batch adding PDFs). Ideally the subfolder name will become a tag in mendeley but I was settling for just saving the subfolder metadata somewhere on the file. – Nathan Tankus Jun 20 at 19:37
  • Does [author] [year] [title] mean filenames like [Vourvoulias] [2012] [Ink], Vourvoulias 2012 Ink, or otherwise? How do you deal with ambiguous metadata? Do filenames have suffixes (like .txt) and should they be preserved? Should only regular files be renamed, not directories? I recommend you edit with this info. If you want answers about importing to the database, you should give full details on that too. (But you don't have to; one way is to make a text file of the names, ensure you can rename in both directions with it, and separately figure out how to add it to the database.) – Eliah Kagan Jun 20 at 22:33
  • @EliahKagan edited in answers to your questions above. Hope that is sufficient. – Nathan Tankus Jun 20 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.