.NET Framework - Finding YYYYMMDD_YYYYMMDD files with regexp
Asked By Uwe Ziegenhagen
20-Nov-09 03:14 PM
Hi,
I have several hundred files here which accidently got renamed after the
following pattern:
YYYYMMDD_YYYYMMDD-something
where the first date does not match the second date. How can I get the
file which follow this pattern?
Thanks from Germany,
Uwe
Germany
(1)
YYYYMMDD
(1)
Sanity
(1)
Butit
(1)
Al Fansome replied to Uwe Ziegenhagen
This does not do an sanity checking on whether the dates make sense, but
it will match your pattern
ls | % {if ($_.name -match "\d{8}_\d{8}-.+") {$_}}
You can change that last {$_} to {$_.name} if you just want this to
print out the file names.
Uwe Ziegenhagen replied to Al Fansome
Al Fansome schrieb:
Thanks very much!
Uwe

D.getFullYear()*100+D.getMonth()+1)*100+D.getDate() > > tmp.js echo WScript.Echo( 'set YYYYMMDD = '+D ) > > tmp.js echo @echo off > tmp.bat cscript / / nologo tmp.js > > tmp.bat del tmp.js call tmp del tmp.bat From the proper ISO 8601 format YYYYMMDD, other forms are easily derived. - - (c) John Stockton, nr London UK. ?@merlyn.demon.co.uk done! Perhaps Timo will add this expeditious method to retrieve date in ISO 8601 format YYYYMMDD to his repository. On a side note: I would insert an "@" before the SET statement 1)*100+D.getDate() for / f %%a in ('cscript / / nologo "%temp% \ tmp.js"') do set YYYYMMDD = %%a for %%f in ("%temp% \ tmp.js") do if exist %%f del %%f echo %YYYYMMDD% endlocal & goto :EOF All the best, Timo - - Prof. Timo Salmi mailto:ts@uwasa.fi ftp Year(D)*10000+Month(D)*100+Day(D)> > "%temp%. \ tmp.vbs" echo WScript.Echo "@set YYYYMMDD = " + Cstr(D) > > "%temp%. \ tmp.vbs" cscript / / nologo "%temp%. \ tmp.vbs" > "%temp%. \ tmp.bat" for %%? in (cal de) do %%?l "%temp%. \ tmp.bat" del "%temp%. \ tmp.vbs" echo YYYYMMDD = %YYYYMMDD% - - Todd Vargo (Post questions to group only. Remove "z" to email personal messages) Good. Whichever
mich nicht registrieren. - - Armin Also: Hier kommst du direkt zum Download: http: / / www.microsoft.com / germany / express / download / downloaddetails.aspx?p = vb Und hier noch ein Link: http: / / www.microsoft.com / germany / express / download / webdownload.aspx Dagobert1998 schrieb: Habe das Web-Setup nicht getestet. Hier als ISO http: / / www.microsoft.com / germany / express / download / downloaddetails.aspx?p = iso Nochmal gefragt: Wird beim Start des Setups nach der s*ich nicht" hei?en) - - Armin Beschreibung der Registration ist hier: http: / / www.microsoft.com / germany / express / registration / default.aspx - - Thomas Scheidegger - 'NETMaster' http: / / dnetmaster.net / Kann es sein, dass es thumb / magicalsnap-2010.01.07ldca.png[ / img][ / url] Armin Zingler schrieb: http: / / www.microsoft.com / germany / Express / registration / faq.aspx : 17. Warum sollte ich mich registrieren? Eine Registrierung ist notwendig, um express / download / - - Armin Hallo Dagobert1998, weiter zur Registrierungs-FAQ durchk?mpfen: http: / / www.microsoft.com / germany / express / registration / faq.aspx Und dort dann die Antwort auf Frage 6. Kurzum, wenn Du
05 / 849 Macht euer Windows sicherer: http: / / windowsupdate.microsoft.com - jetzt! http: / / www.microsoft.com / germany / sicherheit / Infos zu aktuellen Patches f?r Windows 7 und WinXP: http: / / patch-info.de 05 / 849 Macht euer Windows sicherer: http: / / windowsupdate.microsoft.com - jetzt! http: / / www.microsoft.com / germany / sicherheit / Infos zu aktuellen Patches f?r Windows 7 und WinXP: http: / / patch-info.de 05 / 849 Macht euer Windows sicherer: http: / / windowsupdate.microsoft.com - jetzt! http: / / www.microsoft.com / germany / sicherheit / Infos zu aktuellen Patches f?r Windows 7 und WinXP: http: / / patch-info.de 05 / 849 Macht euer Windows sicherer: http: / / windowsupdate.microsoft.com - jetzt! http: / / www.microsoft.com / germany / sicherheit / Infos zu aktuellen Patches f?r Windows 7 und WinXP: http: / / patch-info.de
etwa f?r Windows Mobile!) Hier ansonst noch Details in DE: http: / / www.microsoft.com / germany / visualstudio / products / visual-studio / 2010 / http: / / www.microsoft.com / germany / express / future / default.aspx - - Thomas Scheidegger - 'NETMaster' http: / / dnetmaster.net / und nat?rlich 'kostenlos', im schrieb Thomas Scheidegger: die 'Aktivierung' ist auch 'kostenlos' mit Registrierung unter: http: / / www.microsoft.com / germany / express / registration / default.aspx ja, etliche mehr Features (zB f?r Windows Mobile, MSOffice-Zus
Framework Das Visual Studio 2010 wird nun auch selber voll Mobil: http: / / www.microsoft.com / germany / visualstudio / products / onthego / default.aspx nicht nur f?r Ihr Windows Phone - sondern auch auf Thema her besser passt ;-) [msdn tv = 96 Ausgabe 1.4.2010] http: / / www.microsoft.com / germany / msdn / video / show.mspx?id = 3Dmsdn_de_39322 ciao Frank - - Dipl.Inf. Frank Dzaebel [MCP / MVP C Go description: Das Visual Studio 2010 wird nun auch selber voll Mobil: www.microsoft.com / germany / visualstudio / products / onthego / default.aspx Nutzen Sie die Leistungsfhig