0

i need to write a bat file which can give me the last names of files in a network folder.The names has the specific pattern.simmilar to this pattern.

Deepak.DEMO.yyyymmdd
mcapatna.POWERHOUSE.yyyymmdd

where Deepak.DEMO & mcapatna.POWERHOUSE are fixed but yyyymmdd is variable depends on the year month & date.

  1. I have to find this yyyymmdd using batch programming &
  2. if possible than compare it with current date.if it is today date then proceed further otherwise move these file to different folder. I tried a lot but i am unable to do it.could someone please help me.
The PowerHouse
  • 560
  • 14
  • 29
  • Please put the code you have tried so far with your question... For getting the files with "yyyymmdd" given, you can use the `dir /b *.` command. Check the `/b` switch at `dir /?`. – Daniel Luz Jun 02 '16 at 19:41

1 Answers1

1
for %%i in (Deepak.DEMO.* mcapatna.POWERHOUSE.*) do echo %%~xi

See here for a possible solution to get the date in the same format. Comparing for equality should be trivial.

Community
  • 1
  • 1
Stephan
  • 53,940
  • 10
  • 58
  • 91