Computer Hope
Microsoft => Microsoft DOS => Topic started by: hrm on April 29, 2009, 10:27:01 AM
-
Hi,
I need to read a filename and based on some characters, decide to move the file in appropriate folders. Here is an example:
gibberish_Water_Cloud.abc
gibb_Water_Sky.abc
moregibb_Air_Sky.abc
stillmorgib_Air_Cloud.abc
I need to move these into following four folders that already exist:
Water_Cloud
Water_Sky
Air_Sky
Air_Cloud
Any help will be appreciated.
Thanks
-
This should help, make sure you put it in the same folder as the abc files.
@echo off
for /f %%a in (*Water_Cloud.abc) do move %%a Water_Cloud\%%a
for /f %%a in (*Water_Sky.abc) do move %%a Water_Sky\%%a
for /f %%a in (*Air_Sky.abc) do move %%a Air_Sky\%%a
for /f %%a in (*Air_Cloud.abc) do move %%a Air_Cloud\%%a
Hope this helps
,Nick(macdad-)
-
no need to use the for loop.
move *Water_Sky Water_Sky
-
Oh well...either works
-
yes, either works. but ..............