Copy File With Time Changes
Moderators: Dorian (MJT support), JRL
Copy File With Time Changes
This daily file, LIJ_IP_DAILY_AR_PROCESSED_04222008_052002.TXT needs to be copied to a daily file called CashLIJIP.TXT. I tried to copy it in MS, but can't do it.
LIJ_IP_DAILY_AR_PROCESSED_04222008_052002.TXT
Date Hr/Min/Sec
Any advice?
Thanks
LIJ_IP_DAILY_AR_PROCESSED_04222008_052002.TXT
Date Hr/Min/Sec
Any advice?
Thanks
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Like this:
You'll need to add in the correct paths
Code: Select all
Year>yy
Day>dd
Month>mm
Hour>hh
Min>nn
Sec>ss
Let>source=c:\bla\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yy%_%hh%%nn%%ss%.TXT
CopyFile>source,c:\bla\CashLIJIP.TXT
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
I'm sorry, I thought that was what you wanted - the current time.
If you want to get the file time and date use FileDate and FileTime and parse the result. But, I'm not sure how you can guarantee that the file date and file time match the date/time in the filename. They're not necessarily the same thing.
Perhaps you need to back up a bit and describe your requirements so that we can understand what you are wanting to achieve.
If you want to get the file time and date use FileDate and FileTime and parse the result. But, I'm not sure how you can guarantee that the file date and file time match the date/time in the filename. They're not necessarily the same thing.
Perhaps you need to back up a bit and describe your requirements so that we can understand what you are wanting to achieve.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
I'm sorry if wasn't clear. The daily file,LIJ_IP_DAILY_AR_PROCESSED_04272008_052002.TXT needs to be copied to the file,CashLIJIP.TXT on a daily basis. The 04272008 represents today's date and the 052002 represents the time the file was created (5 AM,20 minutes and 02 seconds).
I am able to read the date, but how do I parse out the time. I tried using filetime, but was not successful. Also tried repeat/until loops.
Hope this explains it.[/quote]
I am able to read the date, but how do I parse out the time. I tried using filetime, but was not successful. Also tried repeat/until loops.
Hope this explains it.[/quote]
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Let's see if we can make this simpler. I wonder if the time in the filename really matters. Are you not actually just wanting to copy the latest file in the folder each day? Or copy the latest file in the folder where the filename contains today's date? Wouldn't that do the same thing? Or even just any file with today's date e.g:
Is it ok to, once every hour, copy the following:
LIJ_IP_DAILY_AR_PROCESSED_MMDDYYYY_*.TXT
Where MMDDYYYY is today's date ...
Or we can find the latest file in the folder and check to see that it contains today's date in the filename. Would that work?
The macro could even be scheduled to take place whenever there's a new file in that folder. The macro then just copies the latest file matching the above spec.
Is it ok to, once every hour, copy the following:
LIJ_IP_DAILY_AR_PROCESSED_MMDDYYYY_*.TXT
Where MMDDYYYY is today's date ...
Or we can find the latest file in the folder and check to see that it contains today's date in the filename. Would that work?
The macro could even be scheduled to take place whenever there's a new file in that folder. The macro then just copies the latest file matching the above spec.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Automation Wizard
- Posts: 1101
- Joined: Fri Jan 07, 2005 5:55 pm
- Location: Somewhere else on the planet
Is there only one file per day? If so the challenge is finding the time in the name of that file, something like this:
Code: Select all
Year>yy
Day>dd
Month>mm
//check if there is only 1 matching file otherwise abort
CountFiles>c:\Temp\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yy%*.TXT,lijcount,0
MDL>lijcount
If>lijcount=1,dothis,theend
Label>dothis
//get the full name of today's file
GetFileList>c:\temp\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yy%_*.TXT,fname,;
MDL>fname
//parse filename to get time
Separate>fname,_,fparts
MDL>fparts_7
Let>source=c:\temp\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yy%_%fparts_7%
MDL>source
CopyFile>source,c:\temp\CashLIJIP.TXT
Label>theend
Code: Select all
Year>yyyy
Day>dd
Month>mm
REM Inpatient file
copyfile>U:\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yyyy%_*.TXT,U:\CashLIJIP.TXT
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Try:
Code: Select all
Year>yyyy
Day>dd
Month>mm
Let>RP_WAIT=1
Let>RP_WINDOWMODE=0
Run>cmd.exe /c copy "U:\LIJ_IP_DAILY_AR_PROCESSED_%mm%%dd%%yyyy%_*.TXT" "U:\CashLIJIP.TXT"
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?