user214260
user214260

Reputation: 35

.bat Wildcard for a Folder

How do you use wildcards in a Folder?

7z x -oS:\Technology\FEFTP\* S:\Technology\FEFTP\*.zip

ren S:\Technology\FEFTP\Export_Job9_04-08-2014_16-24(wildcardthis) TestFolderRename 

ren S:\Technology\FEFTP\TestFolderRename\*.CSV test1.csv

move S:\Technology\FEFTP\TestFolderRename\*.CSV S:\Technology\FEFTP\Test

What would be the best way to go about this? I need a wildcard to replace Export_Job9_04-08-2014_16-24. It will be the only thing in the folder so it does not need to be that specific. I tried *E, E?, but that did not work. What is the proper method to use?

Upvotes: 1

Views: 384

Answers (1)

MC ND
MC ND

Reputation: 70923

for /d %%a in ("S:\Technology\FEFTP\Export*") do ren "%%~fa" TestFolderRename

Obviously, it will only work if (as stated) you have only one Export* folder (you can not rename two folders to the same name), and if TestFolderRename does not exist (name collision).

Upvotes: 1

Related Questions