Solved

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

Posted on 2001-09-14
4
125 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
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 62
NiceHashMiner... any one no how to get rid of it? 6 38
Microsoft Word startup Issue 7 24
sql server service accounts 4 19
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
An article on effective troubleshooting
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

813 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now