how to move files from another folder (in batch)?

R

ricardo.l

I have a folder (L1) with a large number of folders within (L2).
Each subfolder just contains a subfolder (L3) with some files.
I need to move all the files one level up so basically they would end up
within L2, together with empty L3.

I have considered a batch file with for statement, but I don't know how to
move files without navigating down to each L3 folder, which have unique name.
And I think it works only with single command...

Any idea or workaround to perform the task would help. Thanks a lot.
 
T

TonySper

If you want to do it with a command you can use XCOPY. If you want to do it
manually just use explorer. Click on the folder LI and you should have
folder L2 and L3 in site. Go to L3 and left click on any one file then press
CTRL+A which selects all the files in L3. Now hold the left button down on
any file and mouse drag them over to L2. You are done.
TonySper
 
R

ricardo.l

TonySper said:
If you want to do it with a command you can use XCOPY. If you want to do it
manually just use explorer. Click on the folder LI and you should have
folder L2 and L3 in site. Go to L3 and left click on any one file then press
CTRL+A which selects all the files in L3. Now hold the left button down on
any file and mouse drag them over to L2. You are done.
TonySper

As the number of folders is large as I said It is not feasible manually.
I'll check out xcopy...
 
T

TonySper

No matter how large the folder is, when you click on any file in the folder
and press "CTRL+A" it will capture all the files and sub folders and then
all you have to do is paste them into the folder you want. This is fast.
TonySper
 
R

ricardo.l

with "large number" I means about 100 or so. Not in size...
perhaps I'll be able to write a batch file with a command using xcopy..
 
S

Spid

ricardo.l said:
with "large number" I means about 100 or so. Not in size...
perhaps I'll be able to write a batch file with a command using xcopy..




---
avast! Antivirus: Inbound message clean.
Virus Database (VPS): 090123-0, 23/01/2009
Tested on: 24/01/2009 15:43:48
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com
I agree with Ricardo. It's very easy to move 100's of folders and files up
one level using, for example, <Cntl A>, <Cntl X>, Move to the destination
L1 folder, <Cntl V>. Something I do regularly



---
avast! Antivirus: Outbound message clean.
Virus Database (VPS): 090123-0, 23/01/2009
Tested on: 24/01/2009 15:48:45
avast! - copyright (c) 1988-2009 ALWIL Software.
http://www.avast.com
 
R

ricardo.l

As I have pointed out in my question, I need to move files only, not the
containing folder (L3).
The structure I have described (L3 nested in L2 nested in root L1) is the
same for each and any of the 100 or so folders I have.
I have to automate this process, that's why I need to write a batch program.
Using a pseudo-code how would you do it?

Say I want to do it with a for statement:

for %%f in ( folders set) do "command"

the problem is to write the "command", because 'move' doesn't work unless I
am in L3 (and I can not navigate in each L3, because they have each a
different name). So I need to have a command that works from L2.

Perhaps is there another NG about this topic?
 
T

TonySper

Spid.
He does not get the function of how the CTRL+A works yet. Yes you can use a
batch file with XCOPY and move from folder to folder if you want to do all
that work but look into the CTRL+A it will move all your file from one
folder to the other fast. It does not care how large the files are or if you
have 1000 files. It will move or copy them, fast.
TonySper
 
S

Shenan Stanley

ricardo.l said:
I have a folder (L1) with a large number of folders within (L2).
Each subfolder just contains a subfolder (L3) with some files.
I need to move all the files one level up so basically they would
end up within L2, together with empty L3.

I have considered a batch file with for statement, but I don't know
how to move files without navigating down to each L3 folder, which
have unique name. And I think it works only with single command...

Any idea or workaround to perform the task would help.
If you want to do it with a command you can use XCOPY. If you want
to do it manually just use explorer. Click on the folder LI and you
should have folder L2 and L3 in site. Go to L3 and left click on
any one file then press CTRL+A which selects all the files in L3.
Now hold the left button down on any file and mouse drag them over
to L2. You are done.

ricardo.l said:
As the number of folders is large as I said It is not feasible
manually. I'll check out xcopy...
No matter how large the folder is, when you click on any file in
the folder and press "CTRL+A" it will capture all the files and sub
folders and then all you have to do is paste them into the folder
you want. This is fast.
I agree with Ricardo. It's very easy to move 100's of folders and
files up one level using, for example, <Cntl A>, <Cntl X>, Move to
the destination L1 folder, <Cntl V>. Something I do regularly
He does not get the function of how the CTRL+A works yet. Yes you
can use a batch file with XCOPY and move from folder to folder if
you want to do all that work but look into the CTRL+A it will move
all your file from one folder to the other fast. It does not care
how large the files are or if you have 1000 files. It will move or
copy them, fast.


Perhaps if everyone read the original posting and took the time to
understand it (comprehension, not just making up what you believe
the problem is.)

From the original:
"... a folder (L1) with a large number of folders within (L2).
Each subfolder just contains a subfolder (L3) with some files.
.... need to move all the files one level up so basically they
would end up within L2, together with empty L3 ..."

The directory structure looks like this:
\Level1
\Level2
\Level3

There is only *one* Level1 folder.
There may be 100's of Level2 folders and each of the Level2 folders contain
one each Level3 folder.

So something like this:

\MainFolder\SubFolder(1)\Sub-SubFolder(1)
\MainFolder\SubFolder(2)\Sub-SubFolder(2)
\MainFolder\SubFolder(3)\Sub-SubFolder(3)
\MainFolder\SubFolder(4)\Sub-SubFolder(4)
\MainFolder\SubFolder(5)\Sub-SubFolder(5)
....
\MainFolder\SubFolder(995)\Sub-SubFolder(995)
\MainFolder\SubFolder(996)\Sub-SubFolder(996)
\MainFolder\SubFolder(997)\Sub-SubFolder(997)
\MainFolder\SubFolder(998)\Sub-SubFolder(998)
\MainFolder\SubFolder(999)\Sub-SubFolder(999)

Now - what the original poster would like to do is move all of the Level3
folders to Level2. Since there are many unique Level2 folders containing
each a single Level3 folder with files in it, dragging and dropping would
mean opening each unique Level2 folder and dragging/dropping the folder it
contains to the Level1 subfolder area (making it a Level2 folder instead of
a Level3 folder.) If there are hundreds, this could get quite tiresome. If
this is something that has to be repeated periodically (for whatever reason)
it could come downright annoying. Something else that would have to be
confirmed (or assumed) - all Level3 folders have an unique name.

What you two (TonySper and Spid) seem to be missing is the fact that there
are hundreds of unique Level2 folders containing one-each Level3 folder and
it is the Level3 folders that need to be moved out. CTRL+A works great to
highlight everything you see - so they could easily select ALL Level2
folders and perform whatever on all of them and their subfolders - but that
leaves the Level2\Level3 structure intact - not what is trying to be
accomplished.

With my layout above, what would be accomplished in the end - if I am
understanding the OP correctly - is the following:

\MainFolder\SubFolder(1)
\MainFolder\SubFolder(2)
\MainFolder\SubFolder(3)
\MainFolder\SubFolder(4)
\MainFolder\SubFolder(5)
\MainFolder\Sub-SubFolder(1)
\MainFolder\Sub-SubFolder(2)
\MainFolder\Sub-SubFolder(3)
\MainFolder\Sub-SubFolder(4)
\MainFolder\Sub-SubFolder(5)
....
\MainFolder\SubFolder(995)
\MainFolder\SubFolder(996)
\MainFolder\SubFolder(997)
\MainFolder\SubFolder(998)
\MainFolder\SubFolder(999)
\MainFolder\Sub-SubFolder(995)
\MainFolder\Sub-SubFolder(996)
\MainFolder\Sub-SubFolder(997)
\MainFolder\Sub-SubFolder(998)
\MainFolder\Sub-SubFolder(999)

At which point the OP would likely get rid of the original Level2 Folders
and end up with:

\MainFolder\Sub-SubFolder(1)
\MainFolder\Sub-SubFolder(2)
\MainFolder\Sub-SubFolder(3)
\MainFolder\Sub-SubFolder(4)
\MainFolder\Sub-SubFolder(5)
....
\MainFolder\Sub-SubFolder(995)
\MainFolder\Sub-SubFolder(996)
\MainFolder\Sub-SubFolder(997)
\MainFolder\Sub-SubFolder(998)
\MainFolder\Sub-SubFolder(999)

Do you better understand why this would be a job for scripting versus
copy/pasting...?

While I agree - if we are talking a couple of hundred - maybe even up to a
thousand at this point - it could have been done by now with some adept
usage of Windows Explorer (taking in my assumption that every Level3 folder
is uniquely named.) However - if this is something the OP will have to
repeat every so often - having a script to go to the third level and move
them all out
 
A

alpha

ricardo.l said:
I have a folder (L1) with a large number of folders within (L2).
Each subfolder just contains a subfolder (L3) with some files.
I need to move all the files one level up so basically they would
end up within L2, together with empty L3.
I have considered a batch file with for statement, but I don't know
how to move files without navigating down to each L3 folder, which
have unique name. And I think it works only with single command...
Any idea or workaround to perform the task would help.

TonySper wrote: ...

ricardo.l said:
As the number of folders is large ... It is not feasible manually...

TonySper wrote: ...
I agree with Ricardo...

(Spid actually agreed with TonySper.)

TonySper wrote: ...

Shenan said:
Perhaps if everyone read the original posting and took the time to
understand it (comprehension, ...)
Indeed!

...
Now - what the original poster would like to do is move all of the
Level3 folders to Level2.

No!
OP: 'subfolder (L3) with some files ...
OP: 'move all the files one level up' ...
OP: 'end up within L2, together with empty L3'
= the *contents* of each L3 folder to its parent (L2) folder.
Since there are many unique Level2 folders
containing each a single Level3 folder with files in it, dragging and
dropping would mean opening each unique Level2 folder and
dragging/dropping the folder it contains to the Level1 subfolder area
(making it a Level2 folder instead of a Level3 folder.) ..

No!
OP: 'subfolder (L3) with some files ...
OP: 'move all the files one level up' ...
OP: 'end up within L2, together with empty L3'
= the *contents* of each L3 folder to its parent (L2) folder.
Something else that would have to be confirmed (or assumed)
- all Level3 folders have an unique name.

OP: 'each L3 folder, which have unique name'
So much for comprehension.
What you two (TonySper and Spid) seem to be missing is the fact that
there are hundreds of unique Level2 folders containing one-each
Level3 folder and it is the Level3 folders that need to be moved out.

No!
OP: 'subfolder (L3) with some files ...
OP: 'move all the files one level up' ...
OP: 'end up within L2, together with empty L3'
= the *contents* of each L3 folder to its parent (L2) folder.
CTRL+A works great to highlight everything you see - so they could
easily select ALL Level2 folders and perform whatever on all of
them and their subfolders - but that leaves the Level2\Level3
structure intact - not what is trying to be accomplished.

No! OP does not want change to folder *structure*.
OP only wants the *contents* of each L3 folder to its parent (L2)
folder, leaving each L3 folder empty.
...
At which point the OP would likely get rid of the original Level2
Folders ... No!

... my assumption that every Level3 folder is uniquely named...
Why assume? OP: 'each L3 folder, which have unique name'

I suggest you take a well-earned break and then RTFA. </grin>
 
S

Shenan Stanley

<snipped>
http://groups.google.com/group/micr...a8c680b0ba9/ad1eb625c57be2b2#ad1eb625c57be2b2


No! OP does not want change to folder *structure*.
OP only wants the *contents* of each L3 folder to its parent (L2)
folder, leaving each L3 folder empty.

You are correct (and I realized it after I posted) - but the script would
only change slightly (very slightly, actually) and neither way would CTRL+A
drag/drop be easier.

(Although - the same name thing comes more into play with the files being
the moved items. More items, better chance at same name.)
 
S

Shenan Stanley

<snipped>
http://groups.google.com/group/micr...a8c680b0ba9/ad1eb625c57be2b2#ad1eb625c57be2b2


No! OP does not want change to folder *structure*.
OP only wants the *contents* of each L3 folder to its parent (L2)
folder, leaving each L3 folder empty.

Shenan said:
You are correct (and I realized it after I posted) - but the script
would only change slightly (very slightly, actually) and neither
way would CTRL+A drag/drop be easier.

(Although - the same name thing comes more into play with the files
being the moved items. More items, better chance at same name.)

( And yes - I missed the second paragraph about the unique named folders -
but they do not say anything about unique named files. ;-) )

Now - one should likely suggest they move to one of the scripting groups for
a better answer.
 
R

ricardo.l

(Although - the same name thing comes more into play with the files
being the moved items. More items, better chance at same name.)

( And yes - I missed the second paragraph about the unique named folders -
but they do not say anything about unique named files. ;-) )

As I wrote, L2 contains an L3-folder, not other files. So if they stay in L3
they are gonna be able to stay in its parent L2-folder as well.
I 'll keep the empty child (L3) as it's name is still meaningful, associated
to the moved files.

As far as this group is concerned, my only expectation was to learn how to
write a CLI-like command (by xcopy maybe?), if feasible, that I would use
later in script.
But, scripting aside, how to do it from cmd window? That was my mind in
posting here.

Thank you all for contributing so far,
the OP
 
M

marybeth73

( And yes - I missed the second paragraph about the unique named folders -
but they do not say anything about unique named files. ;-) )

As I wrote, L2 contains an L3-folder, not other files. So if they stay inL3
they are gonna be able to stay in its parent L2-folder as well.
I 'll keep the empty child (L3) as it's name is still meaningful, associated
to the moved files.

As far as this group is concerned, my only expectation was to learn how to
write a CLI-like command (by xcopy maybe?), if feasible, that I would use
later in script.
But, scripting aside, how to do it from cmd window? That was my mind in
posting here.

Thank you all for contributing so far,
the OP

Did you ever figure out the answer to your question on how to move
files in sub-level folder up a level (just read the whole thread that
only seemed to acomplishe clarifying what you said to begin with)?
I am trying to move out files out of my itunes folder directory up to
the top level music folder (so I can better deal with duplicates and
start again). I am surprised that this isn't easier to do (copying
files within sub-directories, but then not re-creating the directory
when pasting doesn't seem like it should be that far fetched). I have
been struggling with xcopy, but can't figure it out.

Thanks-Mary
 
J

Jim

Did you ever figure out the answer to your question on how to move
files in sub-level folder up a level (just read the whole thread that
only seemed to acomplishe clarifying what you said to begin with)?
I am trying to move out files out of my itunes folder directory up to
the top level music folder (so I can better deal with duplicates and
start again). I am surprised that this isn't easier to do (copying
files within sub-directories, but then not re-creating the directory
when pasting doesn't seem like it should be that far fetched). I have
been struggling with xcopy, but can't figure it out.

Thanks-Mary

If you install a split-screen viewer ( I use xplorer2 ) , open 1st
folder in left screen and 2nd folder in right screen then drag and
drop file(s) from left to right and vice-versa . ( Haven`t used
Windows Explorer in years ) .
 
T

Twayne

Did you ever figure out the answer to your question on how to move
files in sub-level folder up a level (just read the whole thread that
only seemed to acomplishe clarifying what you said to begin with)?
I am trying to move out files out of my itunes folder directory up to
the top level music folder (so I can better deal with duplicates and
start again). I am surprised that this isn't easier to do (copying
files within sub-directories, but then not re-creating the directory
when pasting doesn't seem like it should be that far fetched). I have
been struggling with xcopy, but can't figure it out.

Thanks-Mary

Files to be moved in L2 on drive D; d:\L1\L2\files
Files to be moved to L1 on drive D; d:\L1\files
Move = copy to new destination, then delete source.
Experiement with test folders & copies first, NOT your good files.

Air code:
D:> copy C:\L1\L2\*^ C:\L1\ :: Get the files in L1\L2 into L1
NOTE: ^ = space; very important it's there.
D:> delete C:\L1\L2\* :: Delete the files in L2, completing
the move.

If there are any spaces in any of the paths and it seems to fail to
execute, then put quotes around the commands. e.gl. "C:\good
files\username\*. If you're fully up to date with u pdates, you won't
need the quotes but if not, you might need them.

So a batch file would look like:

@ echo off
copy C:\L1\L2\* C:\L1\
delete C:\L1\L2\*
pause
:end

Save the above as something.bat. You're done. The pause is just to
give you a chance to look at what happened if you want to. Once you're
happy with it, remove it.


Xcopy could also be used and can copy/delete based on archive bits,
things like that if it's to be only certain files moved.

Cheers,

Twayne
 
R

ricardo.l

Did you ever figure out the answer to your question on how to move
files in sub-level folder up a level (just read the whole thread that
only seemed to acomplishe clarifying what you said to begin with)?
I am trying to move out files out of my itunes folder directory up to
the top level music folder (so I can better deal with duplicates and
start again). I am surprised that this isn't easier to do (copying
files within sub-directories, but then not re-creating the directory
when pasting doesn't seem like it should be that far fetched). I have
been struggling with xcopy, but can't figure it out.

Thanks-Mary

Not yet, in my case also it was matter of adapting the folder structure
before burning backup dvds for an mp3 player.
In my case I can delete L1 to shorten the height of the tree, but that is
not the optimal solution that I was trying to achieve.
 
R

ricardo.l

Did you ever figure out the answer to your question on how to move
files in sub-level folder up a level (just read the whole thread that
only seemed to acomplishe clarifying what you said to begin with)?
I am trying to move out files out of my itunes folder directory up to
the top level music folder (so I can better deal with duplicates and
start again). ..

Not yet, in my case also it was matter of adapting the folder structure
before burning backup dvds for an mp3 player (and its limited file system).
In my case I can delete L1 to shorten the height of the tree, but that is
not the optimal solution that I was trying to achieve.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top