|
Cavalcader
|
 |
« on: June 16, 2006, 02:37:14 PM » |
|
I have a download area that regularly ends up with "orphans" in folders/subdirs (subdirs with a single file) as their former companions are replaced elsewhere by newer or better versions. What I'd like to do is somehow automate going through a particular dir tree, and any files that are by themselves in their own folder are moved to their parent dir. If that then creates another single-file dir, these would then be moved again to the next higher dir (either by running the program/script again or by the program/script checking for it). If anybody knows of something that already does this, please let me know. 
|
|
|
|
« Last Edit: October 03, 2006, 09:16:53 PM by Cavalcader »
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #1 on: July 03, 2006, 02:50:24 PM » |
|
The alternative concept is to match a filename pattern in a root directory with existing subdirs. Any takers? 
|
|
|
|
|
Logged
|
|
|
|
|
Rover
|
 |
« Reply #2 on: July 03, 2006, 06:27:20 PM » |
|
I thought about this a little as a bat file and/or a pascal app. Do you really need this or are you just bored 
|
|
|
|
|
Logged
|
Insert Brilliant Sig line here
|
|
|
|
|
Cavalcader
|
 |
« Reply #3 on: July 04, 2006, 10:51:15 AM » |
|
Hi, Rover -- no, I've been hunting for this for quite some time now.  I've never found anything that will quite do it. Here's a bit of background and discussion of the initial concept, but if you have a better idea I'm all, uh, eyes. 
|
|
|
|
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #4 on: July 11, 2006, 01:51:49 PM » |
|
As this isn't a big solution, i didn't make a complete script out of it. It should work, though. (i hope you have autohotkey installed.) PS: sorry for not having done this before, but i couldn't make recursive functions in ahk.
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #5 on: July 11, 2006, 03:30:34 PM » |
|
Cool! No, no autohotkey yet, but that's easily fixable. I'll give it a shot! 
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #6 on: July 12, 2006, 02:20:14 PM » |
|
As this isn't a big solution, i didn't make a complete script out of it.
Thanks! Credits on the way -- it seems to work with some test files/dirs I made. I noticed a comment line saying [ copy or print] set the following line to "Loop, %Directory%\*, 0, 0" if you'd like the script to not move a file when there is only one file on the folder, but there are any folders. What should I set it to otherwise? I think it's probably ideal like it is now, but it's always good to know one's options.  I didn't see any prompt, although files were moved -- shouldn't I have? What's involved in "complete script" status? A way to prompt for the path or something?
|
|
|
|
« Last Edit: July 12, 2006, 02:26:16 PM by Cavalcader »
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #7 on: July 12, 2006, 06:28:52 PM » |
|
oops... typo. you should set it to if you'd like it to behave like mentioned. It's not a complete script because it doesn't prompt for anything (which makes it unuseful to compile), and i also noticed that it might not move one file it should. see the following tree: Directory one Directory two Directory three file two file one In this tree, file two is the only file on directory three, so, it's moved to directory two. but then, there are 2 files at directory two, which means they won't be moved to directory one, when they should be since originally there was only one file in each directory. See what i mean? Other than that, it's a pretty complete script  As for messages not displaying, might be because there's yet another typo. where is should be
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #8 on: July 12, 2006, 08:15:42 PM » |
|
oops... typo. you should set it to Got it. Thanks! and i also noticed that it might not move one file it should. see the following tree:
Directory one Directory two file one Directory three file two
I rearranged your tree to simplify what I understand you to be describing -- lemme know if I goofed somewhere.  In this tree, file two is the only file on directory three, so, it's moved to directory two. but then, there are 2 files at directory two, which means they won't be moved to directory one, when they should be since originally there was only one file in each directory. Hmm -- that actually would be counterproductive, at least for my concept. I look at it this way: putting a file in a dir adds organization to the file and whatever group it's a part of. Subdirs add more, but if those subdirs only have an orphan, it makes sense to move 'em to the parent. If there was already a file in the parent, then it must be related to the subdir file and it's fine that they're together. (Maybe others would do something different, but I think it makes perfect sense.) I think it's a first-rate script, especially for the first public version!  As for messages not displaying, might be because there's yet another typo. Typo has been squashed -- thanks.  If you have time (or if not, maybe someone else does?) I'd love to work with someone to build a GUI on this puppy. I tend to be a very visual person, and I'll have an easier time using it that way. Depending on your prefs, I can either send you my email address or we can hack it out in this topic. The latter might help others learn more about AutoHotkey, but (without looking) I bet there's already a thread on that topic. I'm doing math finals, which is why I'm kinda short on time to really dig into AHK right now. 
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #9 on: July 13, 2006, 01:14:27 AM » |
|
Had a minute to try it out after the recommended tweaks -- so far only one minor quibble. To use the tree style you used before, which seems to work well: Dir A Dir B Dir C File C
File C gets moved properly to Dir B... Dir A Dir B File C Dir C
...but then since Dir C is empty, file C should end up in Dir A. Does that add a lot of complexity?
|
|
|
|
« Last Edit: July 13, 2006, 01:16:53 AM by Cavalcader »
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #10 on: July 13, 2006, 03:14:31 AM » |
|
Having it displaying something informing you about stome stuff shouldn't be a problem, i just can't do it right now (exams... bah!). As for what you refered in your latest post, it wouldn't happen if you had it set to "Loop, %Directory%\*, 0, 0". If you have the '1' there, it'll see one file and one directory inside a directory and won't move it further down, since there is more than one element inside the dir.
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #11 on: July 13, 2006, 04:40:05 PM » |
|
Having it displaying something informing you about stome stuff shouldn't be a problem, i just can't do it right now (exams... bah!). No problem -- I understand completely.  As for what you refered in your latest post, it wouldn't happen if you had it set to "Loop, %Directory%\*, 0, 0". Aha! Thanks -- I misunderstood when to use that instruction.
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #12 on: July 14, 2006, 02:52:46 PM » |
|
It seems to work, but I'm still not seeing any dialogs. I posted what I have with the edits described above -- I'm not sure what's up. 
|
|
|
|
Logged
|
|
|
|
|
|
|
jgpaiva
|
 |
« Reply #14 on: August 05, 2006, 05:06:38 AM » |
|
 forgot this. thanks! I'm now on vacations, i'll look into it asap. 
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #15 on: August 05, 2006, 05:48:43 PM » |
|
Good deal! I hope you got good grades.  Lemme know what I can do from this end...
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #16 on: August 21, 2006, 09:00:15 PM » |
|
I'm now on vacations, i'll look into it asap.  That sound we now hear in the background is the chirping of crickets far, far away. 
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #17 on: August 24, 2006, 04:59:51 PM » |
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #18 on: September 04, 2006, 05:48:51 PM » |
|
'Kay, so methinks jgpaiva has gotten too busy to continue. Anybody else wanna help finish the script by adding a GUI?Never mind -- false alarm. 
|
|
|
|
« Last Edit: September 05, 2006, 02:39:24 PM by Cavalcader »
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #19 on: September 09, 2006, 12:46:12 PM » |
|
Ok... At last an update! Here is RescueOrphans v1.0.
RescueOrphans v1.0 updated 09-09-2006: Retrieves single files lost in deep directories.
[ Forum Topic][ .ahk Version][ .exe Version] Features a full gui, about box, fixed confirmation dialogs, added a new option (delete folders, which deletes the folder from where the file was moved, if it's an empty folder) and lists the modifications.
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #20 on: September 09, 2006, 06:45:35 PM » |
|
Here is RescueOrphans v1.0.
Wow, you've really been busy! Can't wait to check it out. 
|
|
|
|
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #21 on: September 11, 2006, 04:19:11 PM » |
|
New update... v1.001. Hopefully, some bugs were fixed.
RescueOrphans v1.001 updated 11-09-2006: Retrieves single files lost in deep directories.
[ Forum Topic][ .ahk Version][ .exe Version]
|
|
|
|
|
Logged
|
|
|
|
|
Cavalcader
|
 |
« Reply #22 on: September 12, 2006, 03:01:42 PM » |
|
JG, first I gotta say...  Here's something we talked about earlier: Dir A Dir B Dir C File C
File C gets moved properly to Dir B... Dir A Dir B File C Dir C
...but then since Dir C is empty, file C should end up in Dir A. Does that add a lot of complexity? That's since been addressed by the second checkbox in the GUI, I think -- but having it checked or unchecked doesn't seem to affect this scenario: Dir A File A1 File A2 Dir B File B1 Dir C File C1 File C2 File C3 Dir D File D1 File D2 File D3
C & D are in B, and all are in A. What I'm running into is that B1 is moved to A regardless of the setting of the second checkbox. (Does that make sense? Let me know if I've explained it clearly.) Regardless of such a trivial issue, like I said in a private note, you've done a first-rate job! 
|
|
|
|
|
Logged
|
|
|
|
|
jgpaiva
|
 |
« Reply #23 on: September 14, 2006, 04:50:50 AM » |
|
Oops.. That was a bug. Now fixed.. Please redownload:
RescueOrphans v1.002 updated 14-09-2006: Retrieves single files lost in deep directories.
[ Forum Topic][ .ahk Version][ .exe Version]
|
|
|
|
|
Logged
|
|
|
|
|
|
|