1.

Solve : Read Characters from filename and move the file to a subfolder?

Answer» 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.

Code: [Select]@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.
Code: [Select]move *Water_Sky Water_Sky
Oh well...EITHER worksyes, either works. but ..............


Discussion

No Comment Found