hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Copy files based on date created of yesterday

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Variables and Regular Expressions
View previous topic :: View next topic  
Author Message
Seb



Joined: 08 Feb 2008
Posts: 4

PostPosted: Fri Feb 08, 2008 8:48 am    Post subject: Copy files based on date created of yesterday Reply with quote

Hello-

On the hour, every hour, I have a system creating files named as follows:

08020805.00W

The above was created on 2008, February 8, at 0500 hours and 00 minutes.

I need to take all the files from the previous day, and zip and FTP them using JaSFTP.

I am able to get the software to do the above for the day of, but not the day before.

I played with the following variables for filename selection:

$%DATEADD::dd::-1%$**.**W (got files from yesterday to midnight, but beginning at the time that the task was run.) This may work, assuming the copy command is issued the earliest as possible the next day.... however I do not know if this is possible, the copy command may need to be issued around 0300.

$%DATE:dd%$**.**W gets all the files from today and the zip command uses the string $%DATE:yy%$.zip with the 'append date to ZIP archive name' option. The zip file needs to be in the same format of the files.... 080208.zip

Any help would be appreciated, I look forward to hearing back!!!!

Seb
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Fri Feb 08, 2008 9:48 am    Post subject: Reply with quote

You should use the DATEADDX function:

1) I assume that your previous days files are:
08020801.00W , 08020805.00W ...etc
so 080208 should match all required files.
For the Filename field use:
$%DATEADDX::YYppdd::dd::-1%$

2) For the zip filename use:
$%DATEADDX::YYppdd::dd::-1%$.zip
no need to use the append to filename field.
Back to top
View user's profile Send private message
Seb



Joined: 08 Feb 2008
Posts: 4

PostPosted: Fri Feb 08, 2008 10:45 am    Post subject: Reply with quote

Robert-

Thank you for the reply, I'm headed to the machine to try it now.

The previous days files are named like so

Feb 8th
08020823.00W
08020822.00W
08020821.00W
....
08020802.00W
08020801.00W
08020800.00W

Feb 7th
08020723.00W
08020722.00W
08020721.00W
....
08020702.00W
08020701.00W
08020700.00W

Off to try it now, I'll let ya know how it works!

Seb


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

Edit-

Here is my copy string
$%DATEADDX::yyppdd::dd::-1%$

I executed this at Feb 08 18:53 on the computer clock, and copied these files:

08020718.00W
08020719.00W
08020720.00W
08020721.00W
08020722.00W
08020723.00W

The zip command works just fine Very Happy
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Fri Feb 08, 2008 11:00 am    Post subject: Reply with quote

It seems like it copied only files in the last 24 hours. Make sure you do not have the option selected to process files newer than 1 day?

otherwise the filename field used based on the variable should pick 08020700.00W etc. also since the variable filename resolves to 080207.
Back to top
View user's profile Send private message
Seb



Joined: 08 Feb 2008
Posts: 4

PostPosted: Fri Feb 08, 2008 11:31 am    Post subject: Reply with quote

Ahhhh I did have that box checked!

Something interesting - there was a file with the name

07080207.00W

that got copied also. Is there a way to make sure the previous years dont get copied?

Unfortunately the system producing these files does not have the YYYY setup Sad, just two digits
----------

edit-

duh, my problem before is now my solution. I checked the box for copy files if newer than 2 days Smile
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Fri Feb 08, 2008 11:55 am    Post subject: Reply with quote

glad to know you figured everything out Very Happy
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 596
Location: Santa Barbara, california

PostPosted: Sun Feb 10, 2008 9:25 am    Post subject: Reply with quote

>> Unfortunately the system producing these files does not have the YYYY setup Sad, just two digits <<

You should use yy instead of YY
YY = 2008
yy = 08
Back to top
View user's profile Send private message Send e-mail
Seb



Joined: 08 Feb 2008
Posts: 4

PostPosted: Tue Feb 12, 2008 1:45 pm    Post subject: Reply with quote

Well-

A related question....

I would like to FTP each hourly file as its created, 5 minutes after the hour.

I inputted this string into the filename box

$%DATEADDX::******hh::hh::-1%$

It worked once, but the new one was showing a created date of the same hour... so the new one didn't get FTP'd.

The examples of the filenames are:

08021221.00W
08021222.00W
08021223.00W
08021300.00W
08021301.00W
08021302.00W
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Tue Feb 12, 2008 4:45 pm    Post subject: Reply with quote

The DATEADDX had a bug which was fixed in 7.43

please update to 7.43 using the patch update from support page.
Shut down NT service if using it (from service control manager)
shut down engine and user interface
apply the patch
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Variables and Regular Expressions All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group