StephenTS
2009-07-12 01:32:47 UTC
Based on:
a) files named in pattern of "filename_by_name.ext"
b) where "_by_" is common to all files
c) "name" needs to be created as a folder name
d) files matching that "_by_name" to be moved into appropriate folder
e) length of "filename" is variable
f) list of "name" names is variable and unknown
Current setup in batch file:
md a
md b
md ...
md n
md ...
move *_by_a*.* a
move *_by_b*.* b
move *_by_...*.* ...
move *_by_n*.* n
move *_by_...*.* ...
From there then manually:
Create subdirectory within n
Find all files with name in them...
Move files
Need something to:
md name
move *_by_name.* name
[repeat for next file]
I realize this is probably an IF / THEN / FOR type issue as well as
needing LOOP in it but I've been trying to figure this out on my own
from time to time for over a year to no avail. Again, the only thing
common in the filenames is "_by_" being contained within and that
distance in being variable so I can't really use SORT based on n in.
Also as mentioned above, the list of names is not known prior therefore
an answer such as 'this previous thread'
(http://forums.techarena.in/server-scripting/971258.htm) won't suffice,
the list needs to be retrieved within the directory the batch is run.
Thank you in advance.
a) files named in pattern of "filename_by_name.ext"
b) where "_by_" is common to all files
c) "name" needs to be created as a folder name
d) files matching that "_by_name" to be moved into appropriate folder
e) length of "filename" is variable
f) list of "name" names is variable and unknown
Current setup in batch file:
md a
md b
md ...
md n
md ...
move *_by_a*.* a
move *_by_b*.* b
move *_by_...*.* ...
move *_by_n*.* n
move *_by_...*.* ...
From there then manually:
Create subdirectory within n
Find all files with name in them...
Move files
Need something to:
md name
move *_by_name.* name
[repeat for next file]
I realize this is probably an IF / THEN / FOR type issue as well as
needing LOOP in it but I've been trying to figure this out on my own
from time to time for over a year to no avail. Again, the only thing
common in the filenames is "_by_" being contained within and that
distance in being variable so I can't really use SORT based on n in.
Also as mentioned above, the list of names is not known prior therefore
an answer such as 'this previous thread'
(http://forums.techarena.in/server-scripting/971258.htm) won't suffice,
the list needs to be retrieved within the directory the batch is run.
Thank you in advance.
--
StephenTS
------------------------------------------------------------------------
StephenTS's Profile: http://forums.techarena.in/members/113820.htm
View this thread: http://forums.techarena.in/server-scripting/1212836.htm
http://forums.techarena.in
StephenTS
------------------------------------------------------------------------
StephenTS's Profile: http://forums.techarena.in/members/113820.htm
View this thread: http://forums.techarena.in/server-scripting/1212836.htm
http://forums.techarena.in