Get file name, search string and rename
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
Get file name, search string and rename
I have to monitor folders that contain PDF files named 12345678901-1.PDF, 12345678902-1.PDF and so on...
Then I have a recordset that contains PDF name in a certain position and an ID name in another position.
Let's say:
12345678901-1ABCDEFGHILMNOPQRSTUVZ
12345678902-1ZVUTSRQPONMLIHGFEDCBA
I have to process them getting the filename of PDF, search it in recordset and rename it with its relative ID. If I can't find the PDF name in recordset I have to move PDF in a specified folder.
It would be useful if I could search PDF name in multiple possible recorsets files...
Then I have a recordset that contains PDF name in a certain position and an ID name in another position.
Let's say:
12345678901-1ABCDEFGHILMNOPQRSTUVZ
12345678902-1ZVUTSRQPONMLIHGFEDCBA
I have to process them getting the filename of PDF, search it in recordset and rename it with its relative ID. If I can't find the PDF name in recordset I have to move PDF in a specified folder.
It would be useful if I could search PDF name in multiple possible recorsets files...
Last edited by simoneranucci on Mon Mar 09, 2009 7:17 am, edited 1 time in total.
Get file name, search string and rename
Probably I haven't understood something...
What are "recordsets files"? Is this a some database?
You have files:
12345678901-1.PDF
12345678902-1.PDF
etc.
You have database where ID of the file looks so:
12345678901-1ABCDEFGHILMNOPQRSTUVZ
12345678902-1ZVUTSRQPONMLIHGFEDCBA
I understood so, you want to rename file
12345678901-1.PDF
to
12345678901-1ABCDEFGHILMNOPQRSTUVZ.PDF
Is this correct?
If you can't find corresponding ID in database you want to move the file into some folder
If I understood you incorrectly describe your problem in more detail, please.
What are "recordsets files"? Is this a some database?
You have files:
12345678901-1.PDF
12345678902-1.PDF
etc.
You have database where ID of the file looks so:
12345678901-1ABCDEFGHILMNOPQRSTUVZ
12345678902-1ZVUTSRQPONMLIHGFEDCBA
I understood so, you want to rename file
12345678901-1.PDF
to
12345678901-1ABCDEFGHILMNOPQRSTUVZ.PDF
Is this correct?
If you can't find corresponding ID in database you want to move the file into some folder
If I understood you incorrectly describe your problem in more detail, please.
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
Get file name, search string and rename
I want to rename file 12345678901-1.PDF to ABCDEFGHILMNOPQRSTUVZ.PDF and I have to find 12345678901-1 key in more than one TXT file.
Thank you!
Thank you!
Get file name, search string and rename
What will be the result filename, if the key exists in a few text files?...and I have to find 12345678901-1 key in more than one TXT file
What format of these TXT files?
Only such strings:
12345678901-1ABCDEFGHILMNOPQRSTUVZ
12345678902-1ZVUTSRQPONMLIHGFEDCBA ?
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
Get file name, search string and rename
The key should exist only in one file.
The format of text file is a 400bytes record thah has fixed position for 12345678901-1 and ABCDEFGHILMNOPQRSTUVZ fields.
Let's say 12345678901-1 begins at 200 (13 digits) and ABCDEFGHILMNOPQRSTUVZ begins at 300 (21 digits).
The format of text file is a 400bytes record thah has fixed position for 12345678901-1 and ABCDEFGHILMNOPQRSTUVZ fields.
Let's say 12345678901-1 begins at 200 (13 digits) and ABCDEFGHILMNOPQRSTUVZ begins at 300 (21 digits).
Get file name, search string and rename
I hope, that TXT files are in one folder.
If so, I'll try to write an example later.
If so, I'll try to write an example later.
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
Get file name, search string and rename
No reply?
Get file name, search string and rename
See the example below.
It searches PDF files in c:\incoming
TXT files in c:\txt
and moves the files if not found into c:\dest
It searches PDF files in c:\incoming
TXT files in c:\txt
and moves the files if not found into c:\dest
Code: Select all
;*******************************
;* RoboTask Task file
;* Do not edit in text editor!
;*******************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1380072790
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task221"
Hide=INTEGER|0
ID=INTEGER|1582561618
LocalVariables=STRING|"C_FILE,old_filename,FOUND,C_TXT,C_LIN E,New_Name,MASK"
LogOnAsUser=INTEGER|1
Name=STRING|"Search and rename"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=FOLDER
Action16=FOLDER
Action17=FOLDER
Action18=FOLDER
Action19=FOLDER
Action2=FOLDER
Action20=FOLDER
Action21=FOLDER
Action22=FOLDER
Action23=FOLDER
Action24=FOLDER
Action25=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER
[Actions\Action1]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20090317"
date2=STRING|"20090317"
destvar=STRING|"C_FILE"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\incoming\*.pdf"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action10]
ActionID=STRING|"A_FILE_RENAME"
Enabled=INTEGER|-1
Name=STRING|"Rename File"
Params=FOLDER
[Actions\Action10\Params]
count=STRING|"1"
file0=STRING|"{c_file}"
mask=STRING|"{New_Name}.*"
subdirs=STRING|"0"
[Actions\Action11]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//If found break the loop"
Params=FOLDER
[Actions\Action11\Params]
comment=STRING|"If found break the loop"
[Actions\Action12]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action13]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action14]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action15]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action15\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{found}"
[Actions\Action16]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//If found break the loop"
Params=FOLDER
[Actions\Action16\Params]
comment=STRING|"If found break the loop"
[Actions\Action17]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"
[Actions\Action18]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action19]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action2]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""OLD_FILENAME"" with value ""{ExtractFileNameNoExt({c_file})}"""
Params=FOLDER
[Actions\Action2\Params]
expand=STRING|"1"
varname=STRING|"OLD_FILENAME"
varvalue=STRING|"{ExtractFileNameNoExt({c_file})}"
[Actions\Action20]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{found}"""
Params=FOLDER
[Actions\Action20\Params]
icon=STRING|"1"
msg0=STRING|"{found}"
msg1=STRING|"{c_file}"
msg2=STRING|"{new_name}"
msgcount=STRING|"3"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action21]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action21\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{found}"
[Actions\Action22]
ActionID=STRING|"A_MISC_COMMENT"
Enabled=INTEGER|-1
Name=STRING|"//Move file if not found"
Params=FOLDER
[Actions\Action22\Params]
comment=STRING|"Move file if not found"
[Actions\Action23]
ActionID=STRING|"A_FILE_COPY"
Enabled=INTEGER|-1
Name=STRING|"Copy/Move File"
Params=FOLDER
[Actions\Action23\Params]
destdir=STRING|"c:\dest"
f_count=STRING|"1"
file0=STRING|"{c_file}"
ifexists=STRING|"0"
move=STRING|"1"
subdir=STRING|"0"
[Actions\Action24]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"
[Actions\Action25]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"
[Actions\Action3]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FOUND"" with value ""false"""
Params=FOLDER
[Actions\Action3\Params]
expand=STRING|"0"
varname=STRING|"FOUND"
varvalue=STRING|"false"
[Actions\Action4]
ActionID=STRING|"A_LOOP_FILE"
Enabled=INTEGER|-1
Name=STRING|"File Loop"
Params=FOLDER
[Actions\Action4\Params]
createmode=STRING|"1"
date1=STRING|"20090317"
date2=STRING|"20090317"
destvar=STRING|"C_TXT"
DuringDays=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"C:\txt\*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
subdirs=STRING|"1"
timesize=STRING|"0"
WithoutPath=STRING|"0"
[Actions\Action5]
ActionID=STRING|"A_LOOP_TEXT"
Enabled=INTEGER|-1
Name=STRING|"Text Loop"
Params=FOLDER
[Actions\Action5\Params]
destvar=STRING|"C_LINE"
file=STRING|"{c_txt}"
linecount=STRING|"0"
sourcetext=STRING|"0"
[Actions\Action6]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER
[Actions\Action6\Params]
amount=STRING|"13"
from=STRING|"200"
source=STRING|"{c_line}"
variable=STRING|"mask"
[Actions\Action7]
ActionID=STRING|"A_STR_EXTRACT"
Enabled=INTEGER|-1
Name=STRING|"STR Extract"
Params=FOLDER
[Actions\Action7\Params]
amount=STRING|"21"
from=STRING|"300"
source=STRING|"{c_line}"
variable=STRING|"New_Name"
[Actions\Action8]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action8\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"0"
value1=STRING|"{mask}"
value2=STRING|"{old_filename}"
[Actions\Action9]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FOUND"" with value ""True"""
Params=FOLDER
[Actions\Action9\Params]
expand=STRING|"0"
varname=STRING|"FOUND"
varvalue=STRING|"True"
-
- Posts: 11
- Joined: Wed Mar 04, 2009 1:07 am
- Location: Italy
- Contact:
Get file name, search string and rename
Can you attache the file?