Python Forum
Extract Info from file to rename file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Extract Info from file to rename file
#1
I just found Python a few days ago while looking for a way to rename files and it looks very promising. I would like to rename individual files once they are extracted from a larger file. These files are large format drawings and I want to use the drawing number and drawing name to rename the file. The problem as I see it is that the information is not in a certain line or a group of characters in the document but is a group of characters in a certain location on the drawing and this location can vary depending on the firm that created the drawing. The following is how I would like to setup the new file name:

Numbering prefix - 3 digit number that can be incremented by 1's, 5's, or 10's

Drawing Number - Located in the same position on all drawings for a specific project but has various configurations (ex. A100, S-100, M100B-14, etc).

Drawing Title - Located in the same position on all drawings for a specific project but may be multiple lines and may be oriented horizontally or vertically on the drawing.

Is it possible to use Python to create a program that will rename files based on these parameters?
Reply
#2
Yes, it is.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
Certainly it's possible, but may be not so trivial. What is the file format? Is it possible to extract that information as text or you will need to use OCR?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#4
The file is PDF and OCR will be required.
Reply
#5
See saram.
I came across this program today. I don't have it though because I don't need it.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to write variable in a python file then import it in another python file? tatahuft 4 1,051 Jan-01-2025, 12:18 AM
Last Post: Skaperen
  JSON File - extract only the data in a nested array for CSV file shwfgd 2 1,174 Aug-26-2024, 10:14 PM
Last Post: shwfgd
  FileNotFoundError: [Errno 2] No such file or directory although the file exists Arnibandyo 0 1,200 Aug-12-2024, 09:11 AM
Last Post: Arnibandyo
  rename same file names in different directories elnk 5 2,569 Jul-12-2024, 01:43 PM
Last Post: snippsat
  Extract and rename a file from an Archive tester_V 4 4,058 Jul-08-2024, 07:54 AM
Last Post: tester_V
  "[Errno 2] No such file or directory" (.py file) IbrahimBennani 13 6,901 Jun-17-2024, 12:26 AM
Last Post: AdamHensley
  Rename first row in a CSV file James_S 3 1,696 Dec-17-2023, 05:20 AM
Last Post: James_S
  file open "file not found error" shanoger 8 9,450 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Input network device connection info from data file edroche3rd 6 2,889 Oct-12-2023, 02:18 AM
Last Post: edroche3rd
  Need to replace a string with a file (HTML file) tester_V 1 2,017 Aug-30-2023, 03:42 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020