Jump to content
Macro Express Forums

Automatic Folder Sorting


selkov

Recommended Posts

I would use a Repeat With Folder to get all the sub-folders and in that loop I would do another repeat with folder. In that one I would simply increment an integer N1 to count how many there are. Next use a condition If N1 =1 move to \1, Else \2.

 

Now in some cases I've found that strange things can arise when the the contents of the folder being repeated with are changing. Say for instance renaming in place. I don't think this will be an issue for you in this case but if you ever yo have a problem I recommend creating a list of folders first and saving it to a file then doing an Text File Process loop instead.

Link to comment
Share on other sites

"I would use a Repeat With Folder to get all the sub-folders and in that loop I would do another repeat with folder. In that one I would simply increment an integer N1 to count how many there are. Next use a condition If N1 =1 move to \1, Else \2."

 

 

 

I fear this is currently beyond my knowledge. Does anyone have a macro close to this that i can use to learn from?

Link to comment
Share on other sites

<REP3:07:000007:000001:0001:0:01:m:\archive><REM2:Resets the item counter><IVAR2:01:01:0><REM2:Counts the numbers of folders><REP3:07:000007:000001:0002:0:01:%T1%><NMVAR:08:01:0:0000001:0:0000000><ENDREP><REM2:Adds to the count the number of files. ><REP3:07:000001:000001:0002:0:01:%T1%><NMVAR:08:01:0:0000001:0:0000000><ENDREP><REM2:If the count is 1 move to c:\1\ else move to c:\2\><IFVAR2:2:01:1:1><DOFILE:07:NN:m:\archive\%T1%\*.*>m:\1\%T1%\*.*><ELSE><DOFILE:07:NN:m:\archive\%T1%\*.*>m:\2\%T1%\*.*><ENDIF><ENDREP>

You didn't specify if the items we were counting were files or folders so I wrote it to count both. Simply delete the appropriate repeat section if I got this wrong. I have not tested this but it should work. Also I was assuming that the \1 and \2 were at the same level as c:\Archive. If you want them as sub-folders of archive move them back afterwords or else it will mess with the Repeat With Folder commands by introducing a new folder.

Link to comment
Share on other sites

You are very kind. thanks.

 

 

My problem is that i have roughly 1500 sub folders.

In some folders there are multiple files.

In others just one File.

 

What i am looking to do is take all the folders that contain just one file and move them together into a new folder.

The whole folder, not just the file.

And then also group the others.

 

If i can move either set the others are easy to cut and paste to the new location.

Link to comment
Share on other sites

Well,

I have played with it a lot.

I can not get it to work.

Just do not understand this enough I guess.

 

 

Here is where i ended up:

 

<REP3:07:000005:000001:0001:0:01:M:\ARCHIVE><IVAR2:01:01:0><REP3:07:000001:000001:0002:0:01:%T1%><NMVAR:08:01:0:0000001:0:0000000><ENDREP><IFVAR2:2:01:1:1><DOFILE:02:NN:M:\1\%T1%>><DOFILE:07:NN:M:\ARCHIVE\%T1%>M:\1\%T1%><DOFILE:04:NN:M:\ARCHIVE\%T1%>><ELSE><DOFILE:02:NN:M:\2\%T1%>><DOFILE:07:NN:M:\ARCHIVE\%T1%>M:\2\%T1%><DOFILE:04:NN:M:\2\%T1%>><ENDIF><TBOX4:T:4:CenterCenter000600000100:000:T1%T1%

><TBOX4:T:4:CenterCenter000600000100:000:T2%T2%

><TBOX4:T:4:CenterCenter000600000100:000:N1%N1%

><ENDREP>

 

 

I cant seem to move the files and I think it is because there is no destination folder.

Link to comment
Share on other sites

OK...I got it working.

maybe i was to tired last night but this is doing the trick:

 

<REP3:07:000007:000001:0001:0:01:M:\ARCHIVE><REP3:07:000001:000001:0002:0:01:M:\ARCHIVE\%T1%><NMVAR:08:01:0:0000001:0:0000000><ENDREP><TBOX4:T:4:000410000130000600000200:000:N1 %N1%

 

T1 %T1%

 

T2 %T2%><IFVAR2:2:01:1:1><DOFILE:07:NN:M:\ARCHIVE\%T1%>M:\1\%T1%><ELSE><DOFILE:07:NN:M:\ARCHIVE\%T1%>M:\2\%T1%><ENDIF><IVAR2:01:01:0><ENDREP>

 

 

 

Thank you very much for your help.....

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...