Organise files into folder: 10 files per a folder

I have a folder that has hundreds of text files that need to be uploaded. I can only upload 10 files at a time, so I like to organize my files into folders, so each folder only contains 10 files. The folders are numbered sequentially.

Example.

Before organizing:
06

After organizing:
51

I know Keyboard Maestro has a foreach command, but I am not sure how to use it to move the files into folders. Thanks for any advice!

I think there was a similar topic posted not too long ago. Skim the list of topics, or do a search, and it may answer your question. If not, let us know.

The word "upload" can mean many different things. For example, it could mean uploading with a shell command, or it could mean uploading with a web page interface, or it could mean copying the file to a network computer. It could mean so many different things, I wouldn't know how to write any KM code for you until you explain precisely what you mean by "uploading."

If you are limited to 10 at a time, I'm guessing it's a web server with some arbitrary limit of 10.

I am uploading to a website via Google Chrome. But I wasn't actually going to use Keyboard Maestro to upload the files (The files can only be uploaded via Drag and Drop, which I don’t think KM can support). I was just going to use KM to organize all the files into folders, so the files are put into batches of 10 per a folder. If they are batched in folders, it makes it easier to keep track of things when I am uploading, especially as there is a wait of 150 seconds after each upload.

Depending on the destinaton of your uploads, and when you want to make each upload, another solution design is just to get a list of all files to be uploaded, and then do the actual upload in groups of 10. This does NOT require moving any files.

So, for example, if you are uploading to a web site, you could:

  • Use a KM For Each action with a Folder Contents collection
  • Append the path of each file to a Variable
  • Use a KM Variable to count each cycle of the For Each Loop, and when it reaches 10
    • then do the actual upload to the web site
    • Pause until the web page completes
    • Invoke a new web page upload
    • Reset the Variable counter
  • Continue For Each Loop with block of next 10, or you reach the end of the file list.

If that makes sense for your workflow, and you need help in implementing it, just let us know.

I've used KM to drag and drop things. But I won't make you change your desired solution.

I'll let you respond to JM's recommended approach before I say more. He's very wise.

Thanks! I actually use KM to go through the files in blocks of 10. But because I have to wait 150 seconds before the next upload, I often do other things, so sometimes when KM resumes, it selects the wrong 10 (because I might have clicked somewhere that spoiled it's flow). Using folders is a bit easier.

Have you any tips about how to use KM to drag and drop. I used the click and move option, but couldn't get the dragging to work.

Sure, I could help with that, but that's definitely a totally different topic so you should post a new topic, probably called "Need advice on using KM to drag and drop the mouse".

1 Like

That should really not happen with a properly designed Macro.
I would just open a new tab for each upload cycle, having closed the prior tab.
So it should be able to run unattended without any interference.
If you want to upload your macro I'll take a look at it to see if that issue can be avoided.

1 Like