WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Completely change filename (Read 2908 times)
adillife
YaBB Newbies
*
Offline



Posts: 3
Completely change filename
May 16th, 2013 at 3:19pm
 
Hello, I have numerous files that I need to rename. unfortunately whilst most of the characters in the original filename remain constant, some change daily. is there any way that I can use a delimiter in the original name.

For example i need to change the filename of

ccnCN1234_001.pdf     to be      NN55-CCN-E01.pdf

but the "1234" part in the original changes everyday

The output name will always be constant.

can you help?
thankyou.
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: Completely change filename
Reply #1 - May 17th, 2013 at 7:08am
 
Hi,

Most renames are possible, but I am not sure how the name
ccnCN1234_001.pdf
would turn into
NN55-CCN-E01.pdf

For example, is the NN55 a fixed prefix?
Is CCN a fixed string or is it the first 3 chars of the original name in uppercase?
What about E01? Is the "01" the last 2 chars of the original name or is it fixed?

You really need to tell me how "original name" should transform into "new name", your example doesn't make this obvious.
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
adillife
YaBB Newbies
*
Offline



Posts: 3
Re: Completely change filename
Reply #2 - May 17th, 2013 at 4:36pm
 
if '*' could be any character.

Basically anything that arrived as ccnCN****_*** would become NN55-CCN-E01

So if a file arrived with the name 'ccnCN4567_890' then the resultant file name will still be 'NN55-CCN-E01'
or if a file arrived with the name 'ccnCN2222_222' then the resultant file name will still be 'NN55-CCN-E01'

Really provided that the original file carries the prefix of 'ccnCN' then the output filename will always be 'NN55-CCN-E01'

I hope that this makes sense
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: Completely change filename
Reply #3 - May 18th, 2013 at 7:30am
 
Ah, ok, that seems easy enough. See the attached picture.

Create a task based on "Copy Files" - http://www.watchdirectory.net/wdhelp/plugins/wdopAutoCopy.html
Select the option "use dynamic naming" and enter something like
C:\SomeOtherDirectory\NN55-CCN-E01.pdf
as the dynamic name.
At the bottom of the "copy files" window select "remove the file after copy" and "implement as move".

Press next and fill out the other forms. On "Events" select "FILENEW" (and probably FILECHNG as well).
On "Filter Events" create a filter as shown on the attached picture:
When the file name matches ccncn*_*.pdf then the file is processed
Back to top
 

adi.png (54 KB | )
adi.png

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
adillife
YaBB Newbies
*
Offline



Posts: 3
Re: Completely change filename
Reply #4 - May 20th, 2013 at 2:55pm
 
Thank-you Gert, I have tried this on both of our watch-directory pc's and it works great.
I have now been asked to set up a workflow that does multiple renames, ie:

Files starting with   
ccnCN       become   NN55-CCN-E01.pdf
sbmBM     become    NN58-BMC-E01.pdf
lslLU         become    NN56-LSB-E01.pdf
lsbNO       become    NN58-BMC-E01.pdf

I thought about using the rename plugin, is there a way that I can accomplish this.


adi
                       
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2224
The Netherlands
Re: Completely change filename
Reply #5 - May 21st, 2013 at 7:53am
 
This is the way I would implement it (there may be other ways).

Create a new task based on the "Run Subtasks" plugin - http://www.watchdirectory.net/wdhelp/plugins/wdopMultiPlugin.html
Set it to "Run Only 1 SubTask - the First one that Matches"

Create your first subtask (name it ccnCN) by copying the settings of your existing task (see "Create a new SubTask" point 1 on the help page above).
This will copy most settings for the auto-rename you already have. The "Subtask Settings" window will open.
For this subtask enter "*\ccnCN*.pdf" for "Only run this subtask for files matching".

For the 2nd subtask enter the name sbmBM for the subtask, select the first subtask you created above and press the "Copy" button instead of the "Add" button.
On the Subtask settings window enter "*\sbmBM*.pdf" for "files matching".
Select the subtask, press "Configure Plugin" so the "Copy Files" window opens. Change the dynamic name as needed.

Repeat for "lslLU" and "lsbNO".

Optionally you can add a last subtask for all remaining files that do not match the previous subtasks (use "*" for the match pattern).

When you press Next enter the other settings. When you get to "Filter Events", make sure that any filter you add will match all your subtasks:
- do not use any filter so everything matches
or
- use a filter like "file name matches *_*.pdf"

After you have created (and tested) the new task you can remove the original "copy files" task.

You say you run this on multiple computers, see this blog how you can copy settings/tasks from one computer to another:
http://blog-en.gdpsoftware.com/2008/08/move-your-watchdirectory-install-to.html

Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1