[Mac OS X] How do we share a number of files that belong to the same folder, in multiple folders

The tutorial is aimed at users of Mac OS X, who need it share a large number of files in a folder, in multiple folders.

In our case, the problem looks like this:

We have a folder "PSD" which contains 2105 files, and these files we 2105 to create folders each containing no more than 300 file.

Files Folder List Mac OS X

To achieve this, the most simple and convenient we command line from Terminal.

1. open Terminal and navigate to the folder in which fisirele that we want to share. In our case the order will be:
cd / Volumes / Stealth / Graphics / PSD.

2. View the number of existing files and folders in current location:
ls -l | wc -l .

Before proceeding to step 3 is better to make sure that the folder files are not blocked (locked files). If any, during the execution will receive error message "Operation not permitted". With the "-R chflags nouchg *"Will unlock all files in the current location (Unlock multiple files in Mac OS X).

3. Command line divide the total by which the files in the current folder, the folder that contains a defined number of files:
i = 0; for f in *; do d =psd_$ (Printf% 03d $ ((i /300+ 1))); mkdir -p $ d; mv "$ f" $ d; let i ++; done

Where "psd_" is the prefix of the folders to be created, and "300" is the maximum number of files per folder. These parameters can be changed according to your preferences.

Here's how this Terminal tutorial looks:

Screen Shot at 2015 01-16-21.53.44
Stealth Settings - Split a folder with thousands of files into multiple sub-folders.

This tutorial has been tested and realized MacBook Pro cu OS X Yosemite.

[Mac OS X] How do we share a number of files that belong to the same folder, in multiple folders

About the author

Stealth LP

Founder and editor Stealth SettingsIn 2006 date.
Experience on Linux operating systems (especially CentOS), Mac OS X, Windows XP> Windows 10 and WordPress (CMS).

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment is processed.