Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: CreationTime property of a folder (#3587)
Topic Summary:
Created On: 02/08/2012 07:53 AM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by Edward Hulleman, on Friday, February 17, 2012 5:03 AM

Answer:

Thanks Jean, your solution works perfectly.

 02/08/2012 07:53 AM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

Hello,
I want to delete folders that are created >5 days ago.
So I use a 'loop through folders', populate the variable vFolder with the name and then use 'get file Information' to get the CreationTime.
And an if-statement that checks %DateDiff("d",vFileDate,Now())% > 5
It did not work so I showd the CreationTime in a message box. So I found out that it doesn't contain 1 date but 23 dates seperated by a ;
So I ask the creation date of one folder (vFolder) but it contains all the dates of all the folders. How do I get the creationdate per folder?
 
 

 Category Survey


Edited: 02/16/2012 at 11:32 AM by AutoMate Discussion Moderator
 02/08/2012 10:38 AM
User is offline View Users Profile Print this message

Author Icon
Liz Casale
AUTOMATE EMPLOYEE

Posts: 940
Joined: 05/23/2011

Hi Edward,

Could you please export your task and attach it to this forum post so that we may see your steps?

I was able to have folders removed that were older then 5 days from a directory in 3 steps. First step is "If Folder Exists" (i.e. folder name C:\Test\*) and on the Advanced tab specified "Only if older than" and checked Expression which allows you to choose the Custom number of days. This step is then followed by a "Remove Folder" step of which the Folder is C:\Test\*. The last step is the End If step. Any folders older then 5 days were deleted from the Test directory.

 Category Survey


-------------------------
Liz Casale
Technical Support Representative
(213) 738-6966
Network Automation, Inc.

--------------------------------------------------------------------------------

AM5 5.5.5.1; AM6 6.2.8.0; AM7 7.1.3.0; AM8 8.0.9.0; AM9 9.0.3.4
BPA7 7.1.3.0; BPA8 8.0.9.0; BPA9 9.0.3.4
 02/08/2012 01:40 PM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

Sure, here the code and a printscreen



 Category Survey
 02/08/2012 01:44 PM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

I somehow posted this in the wrong group, I am running Automate 8



 Category Survey
 02/08/2012 01:53 PM
User is offline View Users Profile Print this message

Author Icon
Liz Casale
AUTOMATE EMPLOYEE

Posts: 940
Joined: 05/23/2011

Thank you for your post. Did you try the method I posted above by chance?

 Category Survey


-------------------------
Liz Casale
Technical Support Representative
(213) 738-6966
Network Automation, Inc.

--------------------------------------------------------------------------------

AM5 5.5.5.1; AM6 6.2.8.0; AM7 7.1.3.0; AM8 8.0.9.0; AM9 9.0.3.4
BPA7 7.1.3.0; BPA8 8.0.9.0; BPA9 9.0.3.4
 02/09/2012 05:13 AM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

Hello Liz,

Yes I did. Your way the folders get deleted so that's good however somehow it deletes also the folders not older then 5 days. It just deletes them all.

To me the code looks ok, can you see what goes wrong?


Edward

 



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 02/09/2012 07:46 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Edward,
I suspect your locales for dates are ddmmyyyy , which usually causes problems in expressions with dates.

You could try
ISOLDERTHAN="%Now-4%"
or if it does not work
ISOLDERTHAN="%CStr(Now-4)%"

Whichever works for you.
Just a guess.


 Category Survey
AutoMate 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 02/14/2012 06:48 AM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

Hello Jean,

I tried both ways but still it deletes all folders.
Just to make sure that Automate didn't switch the two I tried the same code but put it at 'must be newer then...' but now, they still get deleted.

 

 



 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
 02/14/2012 12:18 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Edward,
in trying your steps, I came to the same conclusion as you found : the "IF folder older than" step does not work.
N/A should have a look.

The workaround is comparing the datecreated to the target in an IF expression, as below

I get the datecreated from a dataset in the loop
I tested it on a folder in my system and it works.
Please try it and tell me the outcome.
Beware of the expression %CDate(ds.CreatedOn)<Now-100% which is for folders older than 100 days.
The CDate() function is of the utmost importance for the comparison to be valid.
Of course in your case it should be 4 instead of 100

 Category Survey
AutoMate 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4


Edited: 02/16/2012 at 10:49 PM by JeanDelfosse
 02/16/2012 11:32 AM
User is offline View Users Profile Print this message

Author Icon
Ricardo Castaneda
HelpSystems

Posts: 3424
Joined: 01/11/2008

Hello,

We have reproduce the issue internally and have entered it into our Database. I apologize for the inconvenience.

 Category Survey
AutoMate 8 version:
Windows version:


-------------------------

Ricardo Castaneda | Principal Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700
 02/17/2012 05:03 AM
User is offline View Users Profile Print this message

Author Icon
Edward Hulleman
Artisan (200-499)

Posts: 232
Joined: 11/07/2006

Answer Answer

Thanks Jean, your solution works perfectly.



 Category Survey
 02/17/2012 06:57 AM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, Edward.

 Category Survey
AutoMate 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 08/05/2015 07:45 AM
User is offline View Users Profile Print this message

Author Icon
AdamConner
Journeyman (50-99)

Posts: 55
Joined: 02/20/2014

Coming in 3 years late to the convo here but wanted to say your CDate solution helped me as well. Was about to go crazy trying to figure out why my IF statement wasn't evaluating properly.

Thanks Jean.



 Category Survey
AutoMate 8 version:
Windows version:
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1681 guests browsing this forum, which makes a total of 1681 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog