Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Moving a fix numbers of files to a new folder.


  • Please log in to reply

#1
MaMister

MaMister

    Member

  • Member
  • PipPip
  • 96 posts
Hi all,

I have a folder with around 80,000 files in it and would like to move them to 3000 files in each new folder.

Any suggestion?
  • 0

Advertisements


#2
tallin

tallin

    Member

  • Member
  • PipPipPip
  • 277 posts
Hello MaMister,

I am not sure really what you mean. Can you explain further please?

If you just want to transfer files from one folder to the other I suggest you do the following:

Make any number of new folders on your desktop naming them whatever suits you.
Then open the folder with the large number of files in it, highlight the files you want to transfer to the new folders on the desktop, left press your mouse and hold over the highlighted files, dragging them into the new folders.

Hope this helps you, please post back with more questions if need be.

kind regards, :)

Edited by tallin, 07 February 2008 - 07:51 PM.

  • 0

#3
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Thanks, I understand the using of Explorer but is there is earlier way or tool that I can do it once instead of :

For 80000 files I need:
Create 27 folders.
Count 3000 files before draging over.

As I may have other folders or in future got to create 2000 files per folder instead.

Thanks for all reply.
  • 0

#4
tallin

tallin

    Member

  • Member
  • PipPipPip
  • 277 posts
Hi MaMister,

I don't know of an quicker method.

I think you have been neglecting homework for some time on your computer. Are you sure you need all those files? How big is your HD and how much space is free?

Tell us about your maintenance program, firewall, spyware and virus software. Are all your definitions up to date?

kind regards,
  • 0

#5
Ztruker

Ztruker

    Member 5k

  • Technician
  • 7,065 posts
You can use the FOR command from a command prompt or in a batch file to do this, Will take some tweaking but definitely doable.

Enter for /? from a command prompt for usage info. Look at this string for starters:

FOR /F "usebackq delims==" %i IN (`dir`) DO @echo %i

The (`dir`) part (that is back ticks, not single quotes) is executed as a command so you could do a

(`dir "c:\path to folder"')

Now you need to figure out how to loop this and include a counter and poof, you're home free. If I can find some time I'll play with this a bit and see if I can come up with a batch file that will work. This is easy to do in Rexx or PHP or PERL or even Visual Basic.
  • 0

#6
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Found this FREE.... Yes, Free but too bad its for MAC OS only... How I wish I have one piece of that :

http://www.qtsync.co...dersplitter.php
  • 0

#7
tallin

tallin

    Member

  • Member
  • PipPipPip
  • 277 posts
Hi again,

I am learning from you now, :) perhaps you could try this LINK. For only $20.00 if it does the job for you it would be well worth the money.......yes?

All the best, :)
  • 0

#8
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Looks like no free for windows.... :)
  • 0

#9
tallin

tallin

    Member

  • Member
  • PipPipPip
  • 277 posts
Hello again,

We would really appreciate some feed back if we helped you.

We can then help others if they have the same problem............thanks :)
  • 0

#10
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Found this post.

http://www.pcreview....ead-1973448.php

Hope that help someone... If not just some kind soul would write a simple tool to help :)
  • 0

Advertisements


#11
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
Hello,

Thought I'd pop in and share. I thought your request sounded like a good challenge for me. Ztruker got me thinking and so I wanted to write the batch file to do what you need. I have uploaded the zipped batch file.

I'll explain. The batch file takes two parameters. The first parameter is the directory you have all the files in. The second parameter is the number of files you want in each new directory. The batch file will process through all the files in the directory, moving the number of files specified to a new subdirectory called "movedn" (n being a directory number).

The syntax is as follows:
mfiles.bat "C:\Test" 3000
This will split all the files located in C:\Test into subdirectories of 3000 files each (C:\Test\moved0, C:\Test\moved1,...). It is important to put quotes around the path name if there is a space included, best to put it in for good measure.

Standard disclaimer: I claim no responsibility if this batch file messes up your system. I wouldn't worry about that though, I ran through a test case with 100 files and it worked flawlessly. The worst it can do is move too many files. :)

Regards,

Ax

Attached File  mfiles.zip   322bytes   269 downloads
  • 0

#12
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Thanks for the good work Ax238.

I am going to test it now.
  • 0

#13
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts
Thanks it works!!!

Only 2 things:

1. Moved0 goes inside of Move1.
2. It has a error "The process cannot access the file" (maybe thats why Moved2 has only 2999 files?)

The rest of the folders where good!!!!!!!!

Btw, is it possible to make it search for subfolders, calculate total and move all files in to the Moved named folders too?

If not then is ok, you already save my day.... :)
  • 0

#14
Ax238

Ax238

    Tech Staff

  • Technician
  • 1,323 posts
Well thanks for giving it a try, I'm glad it worked for you. Hmmm, I'll have to try to reproduce those errors. Can you tell me what the folder name was that contained the files and where you ran the script from? Also, what was the syntax of the script you ran?

I did notice there were problems if you used the script in the same folder as the documents, but I don't think that's the case for you. Maybe I'll look into those problems, thanks for bringing them to my attention. It was a late-night, hastily-written rough script, so I'm sure there are a few bugs yet.

Btw, is it possible to make it search for subfolders, calculate total and move all files in to the Moved named folders too?

I am afraid I don't completely understand what you are trying to do. Yes, it can be made to traverse subfolders. What total are you wanting to calculate? The number of files in a folder?

When you get into traversing subfolders, there would be recursion involved, which can be more difficult to implement.

Let me know on the bolded items.

Ax
  • 0

#15
MaMister

MaMister

    Member

  • Topic Starter
  • Member
  • PipPip
  • 96 posts

Can you tell me what the folder name was that contained the files and where you ran the script from? Also, what was the syntax of the script you ran?

I use a folder f:\test, I copy the script to f: drive and start -> run -> mfiles.dat "f:\test" 3000

What total are you wanting to calculate? The number of files in a folder?

Hmm, let say I have 5 sub folders with different amount of files, I would like to total them and move all into 3000 per folder? without the tree structure, just files total up and split the folder.

Thanks.

Edited by MaMister, 08 February 2008 - 06:19 PM.

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP