In Windows 7 command prompt, I´d like to list all files of a folder which name does not start with abc
. I have tried:
forfiles /P C:\\myFolder\\
Looking at forfiles /?
:
/M searchmask Searches files according to a searchmask. The default searchmask is '*' .
which strongly suggests forfiles
doesn't support regular expressions, just normal Cmd/Windows wildcards.
On Windows 7 this can easily be achieved in PowerShell:
dir c:\myFolder | ?{ -not($_.Name -match '^abc') } | select Name
(That performs a case-insensitive regular expression match, which doesn't matter in the case of Windows filenames.)
NB. Assuming you want files not starting ABC
, which isn't what your (attempted) regular expression says (any filename starting something that isn't a
, b
or c
).