WatchDirectory Forum
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl
watchDirectory forums >> How to... >> How remove 2 digits in the middle on a file
http://www.watchdirectory.net/cgi-bin/yabb25/YaBB.pl?num=1355945192

Message started by Dracir on Dec 19th, 2012 at 8:26pm

Title: How remove 2 digits in the middle on a file
Post by Dracir on Dec 19th, 2012 at 8:26pm
Hello to all

I need to do the following using WatchDirectory, and I am not quite sure how to do it:

The following files are print reports. All pdf files has the same lenght name,  and the digits to deleted  are on the same position.

I would like to delete two digits  in a exacte position on a file.
201209191647380054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
201209191647390054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
201209191647400054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
I need delete the digit position 13 and 14  starting at left
On this case 38, 39 and 40 has to be deleted

The result has to be from
C:\AAA\
201209191647380054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
201209191647390054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
201209191647400054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf

Monitoring the folder who contain these files to modifie every file that appear on this folder and after move this file to other folder.

Move to: (digits 40, 39 and 38 has been deleted)
C:\a\
2012091916470054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
2012091916470054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
2012091916470054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf


Please can you tell me how can I accomplish this using WatchDirectory?

Many thanks

Dracir

Title: Re: How remove 2 digits in the middle on a file
Post by Gert on Dec 20th, 2012 at 7:46am
Hi,

The way I would do this is to use the Copy Files task and enable "dynamic naming", see
http://www.watchdirectory.net/wdhelp/plugins/wdopAutoCopy.html

Do NOT set the option "dynamic name is a directory" and use the following dynamic name:
C:\A\{left{12,{filetitle]}{substring{14,50000,{filename]}

Using the example file
201209191600XX400054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf
{left{12,{filetitle]} will result in the first 12 positions of the filename without extension:
    2012091916
and {substring{14,50000,{filename]} will result in the 50000 pos starting at position 14:
    400054596733HOLTER  MAQUGDEXMED    DEXDAT    .pdf

See also http://www.watchdirectory.net/wdhelp/plugins/dynamicname_functions.html

WatchDirectory Forum » Powered by YaBB 2.5.2!
YaBB Forum Software © 2000-2017. All Rights Reserved.