PDA

View Full Version : Locate does not work well for directory with wildcards


Too_Tall_Crown_Victoria
07-23-2012, 11:09 AM
I am using VBP 8.0 and trying to write a script to search a directory which contains a number of other directories in it. I want to search these based on a wildcard and process only the folders that match.

For example:

C:\Temp\A_123_20120722\
C:\Temp\A_123_20120723\
C:\Temp\B_234_20120722\
C:\Temp\B_234_20120723\

I would like to find and delete any folder matching C:\Temp\*_%T_DATE% where %T_DATE% = 20120722

Thanks

kinook
07-23-2012, 11:32 AM
See the attached sample.

7/23/2012 10:30:53 AM: -------------------- Starting Build: 'DelFolders.bld' --------------------
7/23/2012 10:30:53 AM: Building project step 1 - Project steps...
7/23/2012 10:30:53 AM: Building project step 2 - Create test files...
7/23/2012 10:30:53 AM: Building project step 3 - Write File...
Creating file d:\Temp\test\A_123_20120722\test.txt
7/23/2012 10:30:53 AM: Building project step 4 - Write File...
Creating file d:\Temp\test\A_123_20120723\test.txt
7/23/2012 10:30:53 AM: Building project step 5 - Write File...
Creating file d:\Temp\test\B_123_20120722\test.txt
7/23/2012 10:30:53 AM: Building project step 6 - Write File...
Creating file d:\Temp\test\B_123_20120723\test.txt
7/23/2012 10:30:53 AM: Building project step 7 - Before...

Directory of d:\Temp\test\

0 File(s) 0 bytes

Directory of d:\Temp\test\A_123_20120722

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Directory of d:\Temp\test\A_123_20120723

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Directory of d:\Temp\test\B_123_20120722

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Directory of d:\Temp\test\B_123_20120723

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Total Files Listed:
4 File(s) 16 bytes
7/23/2012 10:30:53 AM: Building project step 8 - Delete folders...
Delete files in folder 'd:\Temp\test\'...
A_123_20120722\test.txt
B_123_20120722\test.txt
2 file(s) deleted
7/23/2012 10:30:53 AM: Building project step 9 - After...

Directory of d:\Temp\test\

0 File(s) 0 bytes

Directory of d:\Temp\test\A_123_20120723

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Directory of d:\Temp\test\B_123_20120723

07/23/2012 10:30:53 AM 4 test.txt
1 File(s) 4 bytes

Total Files Listed:
2 File(s) 8 bytes
7/23/2012 10:30:53 AM: Build successfully completed (elapsed = 00:00:00).