troubleshooting Question

I need to move folders from Source folder into 3 other folders in a "distributed even" way (Ubuntu Bash script)

Avatar of Michael Smith
Michael SmithFlag for Ireland asked on
* BashShell Scripting
3 Comments1 Solution8 ViewsLast Modified:
I have 4 Directories


Through-out the day dozens of folders appear all containing data into DirectoryA - These folders will always have unique names......

I would like to run a script say every hour that would move all Folders (and there sub data) from DirectoryA into the other 3 Directory(B,C,D) so that there are an approximate equal amount of folders in each directory....

DirectoryA has 11 folders in it called 1-11 - All other Directories are empty.....

After script runs
Directory A is empty and
/DirectoryB has folder1, folder2. folder3, folder4       (4 folders total)
/DirectoryC has folder5, folder6. folder7, folder8       (4 folders total)
/DirectoryD folder9, folder10. folder11                        (3 folders total)

1 hour later.... (Before script is ran again)
Directoy A has 8 new folders in it - folders 12-20
/DirectoryB folder1, folder2. folder3, folder4             (4 folders total)
/DirectoryC has folder5,  folder8                               (2 folders total)
/DirectoryD Empty                                                     (0 folders total)

After Script runs
Directoy A is empty
/DirectoryB has  folder1, folder2. folder3, folder4, folder 12             (5 folders total)
/DirectoryC has folder5,  folder8,folder13,folder14                           (5 folders total)
/DirectoryD has folder15 folder16, folder17,folder18                        (4 folders total)

Not sure if i'm doing a good job of explaining  this  - just looking to distribute folders from a "source" folder into 3 other folders via a schedule.

Thanks for reading............
nociSoftware Engineer
Log in to continue reading
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform for $9.99/mo
View membership options
Unlock 1 Answer and 3 Comments.
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
The Value of Experts Exchange in My Daily IT Life

Experts Exchange (EE) has become my company's go-to resource to get answers. I've used EE to make decisions, solve problems and even save customers. OutagesIO has been a challenging project and... Keep reading >>


Owner of Outages.IO
Phoenix, Arizona, United States
Member Since 2016
Join a full scale community that combines the best parts of other tools into one platform.
Unlock 1 Answer and 3 Comments.
View membership options
“All of life is about relationships, and EE has made a virtual community a real community. It lifts everyone's boat.”
William Peck

Member since 2004