Bat file to move some files

March 24, 2009 at 06:15:56
Specs: Windows XP
Hi

I am fairly new at this game and I have to make a batch file that can move files with different names in to their respective subfolders e.g a file starting with SER1 to a subfolder SER1 and so on.

Could some one please help me on how to do that...

This is what I have so far..

@echo off
cd c:\hello
for "%%f in (*ser1) do move G:\SER1\"%%f"

So that all the files starting with ser1 get moved to ser1 and other subdir under SER1


See More: Bat file to move some files

Report •


#1
March 24, 2009 at 07:41:19
So that all the files starting with ser1 get moved to ser1 . . .
MOVE ser1* G:\SER1

. . . and other subdir under SER1
I'm not sure what you're asking for.


Report •

#2
March 24, 2009 at 13:59:54
Hi

Than you for your answer. I amsorry that I did not make my self clear enough but I will try to explane some more.

Let say that a dir. contains these following files:

Sar1xxxxxxx
Sar1-2xxxxxxx
Sar2xxxxx
Cen1xxxxxx
Cen1-2Axxxxxxx
... and so on.

The files are moved to the dir
File SAR1 with SAR1-2 as a subdir.
and file Sar2 to the SAR2 dir.

File Cen1 to cen1 dir
File Cen1-A to a subdir under Cen1 and so on.

If the orginal dir, contains files that are not matched then they will stay in the orginal dir.

I hope that this explained it better


Report •

Related Solutions


Ask Question