troubleshooting Question

How to split the name of the file according to month,day,year and its pattern?

Avatar of namerg
namergFlag for United States of America asked on
Powershell
32 Comments1 Solution321 ViewsLast Modified:
I hope i do not get spanked.
It is something similar on this post:

https://www.experts-exchange.com/Programming/Languages/Scripting/Powershell/Q_28077350.html

I have tasks that create the following files but we do manually check their existence. Would like to automate the file checking.

Task1
The following file (2013_03_27_021208-batch.xls) has YYYY_MM_DD_whatever. We can control the year, day and month but the rest can be anything and is time  stamped today's date at 2:00am.
To do: Need to check of the existence of that file from Monday through Friday

Task 2:
The are five files:YYYYMMDD_whatever_clm.txt, YYYYMMDD_whatever_proc.txt,YYYYMMDD_whatever_pym.txt,YYYYMMDD_whatever_pymt_li.txt,YYYYMMDD_whatever_cc.txt
20130327_14401_clm.txt
20130327_14401_proc.txt
20130327_14401_pymt.txt
20130327_14401_pymt_li.txt
20130325_14401_cc.txt
To Do: Need to check the existence of *_clm.txt,*_proc.txt,*_pymt.txt and *_pymt_li.txt from Monday to Friday. But, on Monday need to check the existence of the *_cc.txt

Task3
There is one file:W_UANETPX_27-MAR-2013.TXT
Constant: W_UANETPX_
Variable: DD-MONTH-YYYY
Constant: .TXT
To Do: Need to check the existence of the file every day according to the pattern and DD-MONTH-YYYY

Taks 4
There is one folder: cg322701
On folder cg322701 we have to make sure the following file exist:
  UPI_YYYYMMDD.txt exists. DD = Today's date - 1 day

Hopefully this gives me enough intelligence to automate my other tasks
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 32 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 32 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros