Folder with varying date based name

Post variable and regex related tips, questions.

Folder with varying date based name

Postby Tech Support » Thu Dec 01, 2016 6:52 am

User Support Request:
We currently need to configure an Automize job to copy the contents of a folder to an alternative location. Sounds easy but the folder name changes each day (Automatically created via an in house developed program). The folder name will start with the same naming convention, followed by the date and finally a coding at the end.

So the folder name that we want to copy from will always begin with “NIGHT_S500000003_D”the date then follows “20161128” with a nine digit code on the end beginning with T.
If we put the full name into the Source directory and manually run the job it will work, however the date and 9 digit code on the end of the folder name changes each day, this means the job will fail going forward.

Is there an option to use a wildcard in order to ignore the 9 digit code at the end of the folder name? Only run the task to look into folders with the same date that the task is running on? $%DATE::YYppdd%$.........
We aim to run the task around 2:00 in the morning as the folder is usually created just after midnight every night.

Your help would be very much appreciated!
Tech Support
Site Admin
 
Posts: 1228
Joined: Thu May 25, 2006 11:12 am

Re: Folder with varying date based name

Postby Tech Support » Thu Dec 01, 2016 6:53 am

Try the following settings:

Source directory = D:\AutomizeTesting
Folder path filter = NIGHT_S500000003_D$%DATE::YYppdd%$T

Advanced tab:
select option to include subdirectories.
Tech Support
Site Admin
 
Posts: 1228
Joined: Thu May 25, 2006 11:12 am

Re: Folder with varying date based name

Postby Tech Support » Thu Dec 01, 2016 6:54 am

User Response:

I have tried your suggestion and it kind of works – many thanks. However, it copies the midnight folder and the correct files within it. Is there a way to exclude the folder but just copy the files?
The copied files are within the nightXXX folder. We just the want the files not the folder.
Tech Support
Site Admin
 
Posts: 1228
Joined: Thu May 25, 2006 11:12 am

Re: Folder with varying date based name

Postby Tech Support » Thu Dec 01, 2016 6:55 am

Try the following instead:

Subdirectory Loop task:
Task Title = subdirloop
task to run = copyfiles
directory = D:\AutomizeTesting
Subdirectory name filter = NIGHT_S500000003_D$%DATE::YYppdd%$T
Option = Run Task if subdirectory exists

copyfiles task:
Source directory = $%subdirloop::CurrentSubdirectoryPath%$
filename = (blank)
folder path filter = (blank)
Tech Support
Site Admin
 
Posts: 1228
Joined: Thu May 25, 2006 11:12 am

Re: Folder with varying date based name

Postby Tech Support » Thu Dec 01, 2016 6:56 am

User response:

That worked. Many thanks.
Grateful for the quick response.
Tech Support
Site Admin
 
Posts: 1228
Joined: Thu May 25, 2006 11:12 am


Return to Variables and Regular Expressions

Who is online

Users browsing this forum: No registered users and 1 guest

cron