Solved

Move a bunch of files from sub folders to the top folder

Posted on 2001-09-14
4
128 Views
Last Modified: 2013-12-28
Is there a way I can move all the files from sub folder to the top folder .. for example I have a lot of files saved as:

C:\Files\A\FileA.txt
C:\Files\B\FileB.txt
C:\Files\C\....
....
....
C:\Files\z\....

I want to move all the files from the C:\Files sufolders and sub sub-folders to the top folder

So the top folders are saved under

C:\Files\FileA.txt
C:\Files\FileB.txt

and so on ...


0
Comment
Question by:amira123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 5

Expert Comment

by:d_hall
ID: 6484279
Well, obviously you yould drag and drop using explorer, but I'm assuming that you have a lot of files to deal with so that is impractical.

Easiest way I can think of is a DOS batch file.  The only caveat is that this may have problems with files with irregular characters in the name (like  .  or  -  ).


Go Start > Run and enter "command" to start a DOS prompt.

Enter "dir C:\Files /S /B /O:G > file.bat"

This will create a list of all the files and their subdirectories in a text file called <file.bat>.

Then open this file by entering "edit file.bat".

Go to the Replace menu item, and replace "C:\" with "copy C:\"

Then at the start of the file add these lines:

  cd c:
  cd Files

Now, if you go back to the prompt and enter "file" the batch file will run and copy all the files from the subdirs into C:\Files


If you want to delete all the files from the subfolders, just use the replace option to replace "copy" with "del".
0
 
LVL 5

Expert Comment

by:d_hall
ID: 6484280
>> Then at the start of the file add these...


On further reflection, might be best to add

  cd c:
  cd\
  cd Files
0
 
LVL 5

Accepted Solution

by:
pelejab earned 50 total points
ID: 6484472
you could also use the find command (ie right click the start button and select find) and set *.txt as files to find in "named" box, and select whole of C: drive in "look-in" box then click the find now button. Once it has finished finding the files click the grey "In Folder" column to sort in folders order and then select all the files using click top file of list then shift click bottom file of list and select cut. Then in windows explorer paste these files to the required directory.
cheers, Pete
0
 

Author Comment

by:amira123
ID: 6484584
Here is a situation where both answers were good.  I thought pelejab's was more convienient for me.
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

631 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question