Basssque
asked on
Scripting a move of folders that do not end with two digits
Can someone provide me with a script that will only move folders that "do not" end with two digits to another folder? Thanks!
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That seems to be formatted to move files opposed to folders.
I changed to to what I thought may work, but it doesn't move anything.
for /f %%c in (c:\folders\*) do (move "%%c" "c:\ARCHIVE\" | findstr /vc:"^*[0-9][0-9]")
I changed to to what I thought may work, but it doesn't move anything.
for /f %%c in (c:\folders\*) do (move "%%c" "c:\ARCHIVE\" | findstr /vc:"^*[0-9][0-9]")
> That seems to be formatted to move files opposed to folders.
It works fine here. Apart from folder names, your code differs from my posted one. It should be:
It works fine here. Apart from folder names, your code differs from my posted one. It should be:
for /d %%c in (c:\folders\*) do (move "%%c" "c:\ARCHIVE" | findstr /v /r "^.*[0-9][0-9]")
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oops, typo. Of course it is -Exclude, not -Include.
- Make a test folder named c:\testdir and c:\targetdir
- Copy some folders to c:\testdir. Be sure to include a mix folders that do and don't end with 2 digits.
- Run the .bat in a cmd window
Open in new window