Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account
Photo

Split large directory into smaller directories


  • Please log in to reply

#1
shiek739

shiek739

    New Member

  • Member
  • Pip
  • 3 posts
On Win2k machine.
Have a large directory of 80k+ files.
Wish to Zip before FTP to another site, but WinZip only accepts 65,535 files in a zip.
Would like to split the directory into smaller subdirectories of 20k+ files automatically.
This isn't a one time usage. The large directory gets created every time we produce a product (weekly) with new files.

Can't find any existing utilities.

Thanks!
  • 0

Advertisements


#2
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
If no one knows of a tool for this, you can write your own dos code. The following will create directories and copy files. Create a text file and save it as a name you like, such as, filesToSmallDirectories.bat where the name is your choice and the extension must be .bat. This example will copy files beginning with the letters a through f. Additional lines are required for g through z. Simply double click on the file's icon to run the .bat file.


mkdir "\My Documents\newFiles"
mkdir "\My Documents\newFiles\a_f"
mkdir "\My Documents\newFiles\g_m"
mkdir "\My Documents\newFiles\n_s"
mkdir "\My Documents\newFiles\t_z"
dir "\My Documents\newFiles"
pause
copy a* "\My Documents\newFiles\a_f"
copy b* "\My Documents\newFiles\a_f"
copy c* "\My Documents\newFiles\a_f"
copy d* "\My Documents\newFiles\a_f"
copy e* "\My Documents\newFiles\a_f"
copy f* "\My Documents\newFiles\a_f"
dir "\My Documents\newFiles\a_f"
pause
  • 0

#3
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
oops - add cd "\My Documents\dataFiles\" after the 1st pause as below:

pause
cd "\My Documents\dataFiles\"
copy a* "\My Documents\newFiles\a_f"

You will need to change "\My Documents\dataFiles\" to the directory path of the large directory.
  • 0

#4
shiek739

shiek739

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
That's certainly the quickest way to do it.
I'll need to check if the filenames come out the same after each production run.
I was thinking they all start with the same letter, but using the first two or three with a wildcard after would work if they're consistent.
Thanks.
  • 0

#5
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
You are welcome and good luck.

note: each week you can use explore to delete the previous week's files and new directories, which you probably do already.
  • 0

#6
shiek739

shiek739

    New Member

  • Topic Starter
  • Member
  • Pip
  • 3 posts
Here's an oddity.

The files are of format BAnnnn.xxx

The four digits represented by nnnn range from 3000 to 7900.

If I use wild cards, copy BA*, or copy BA*.*, it copies all the files.
I have to explicity state the extension for it to work.

BA3*.xxx
BA4*.xxx
etc.

However, it DID work, and took around 36 minutes to split up and copy 81k files to five individual directories.
  • 0

#7
bdlt

bdlt

    Member

  • Member
  • PipPipPip
  • 876 posts
good job - congrats.

FYI - BA3* would probably works as well as BA3*.xxx.
  • 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