Welcome Guest.   Make a donation to an author on the site April 19, 2014, 07:52:47 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Read the full one-year retrospective report on DonationCoder.com.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1] 2 Next   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: DONE: Rescue orphans  (Read 17924 times)
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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.
smiley
« Last Edit: October 03, 2006, 09:16:53 PM by Cavalcader » Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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? smiley
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Rover
Master of Smilies
Charter Member
***
Posts: 628



see users location on a map View Profile Give some DonationCredits to this forum member
« 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  tongue
Logged

Insert Brilliant Sig line here
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #3 on: July 04, 2006, 10:51:15 AM »

Hi, Rover -- no, I've been hunting for this for quite some time now. smiley  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. Cool
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« 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.

* RescueOrphans.ahk (1.1 KB - downloaded 359 times.)
Logged

Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #5 on: July 11, 2006, 03:30:34 PM »

(i hope you have autohotkey installed.)
Cool! No, no autohotkey yet, but that's easily fixable. I'll give it a shot! Thmbsup
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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. smiley  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

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: July 12, 2006, 06:28:52 PM »

oops... typo. you should set it to
[copy or print]
Loop, %Directory%\*, 1, 0
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 smiley

As for messages not displaying, might be because there's yet another typo. where is
[copy or print]
Messages = true
should be
[copy or print]
Messages := true
Logged

Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #8 on: July 12, 2006, 08:15:42 PM »

oops... typo. you should set it to
Got it. Thanks!

Quote
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.  Cool

Quote
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! greenclp

Quote
As for messages not displaying, might be because there's yet another typo.
Typo has been squashed -- thanks. smiley  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.  mrgreen
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« 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
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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. smiley

Quote
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

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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.
tellme

* Rescue Orphans.ahk (1.09 KB - downloaded 329 times.)
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #13 on: August 04, 2006, 11:16:30 PM »

How goes it with the exams?   deal

Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #14 on: August 05, 2006, 05:06:38 AM »

 embarassed  forgot this. thanks!
I'm now on vacations, i'll look into it asap.   Cool
Logged

Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #15 on: August 05, 2006, 05:48:43 PM »

Good deal! I hope you got good grades.  smiley

Lemme know what I can do from this end...
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #16 on: August 21, 2006, 09:00:15 PM »

I'm now on vacations, i'll look into it asap.   Cool
That sound we now hear in the background is the chirping of crickets far, far away.  tongue
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #17 on: August 24, 2006, 04:59:51 PM »

I've added two lines.
[copy or print]
#SingleInstance,Force
#NoTrayIcon

* Rescue Orphans.ahk (1.12 KB - downloaded 331 times.)
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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.  embarassed
« Last Edit: September 05, 2006, 02:39:24 PM by Cavalcader » Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« 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:
Quote
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
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« 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:
Quote
Retrieves single files lost in deep directories.
[Forum Topic][.ahk Version][.exe Version]
Logged

Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« 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

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
jgpaiva
Global Moderator
*****
Posts: 4,710



Artificial Idiocy

see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« 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:
Quote
Retrieves single files lost in deep directories.
[Forum Topic][.ahk Version][.exe Version]
Logged

Cavalcader
Charter Member
***
Posts: 192


Live Long & Prosper

View Profile Give some DonationCredits to this forum member
« Reply #24 on: September 14, 2006, 12:09:05 PM »

Thank you, kind sir!  cheesy thumbs up
Logged

My Linguistic Profile:
  40% General American English
  30% Yankee
  20% Dixie

What Kind of American English Do You Speak?
Pages: [1] 2 Next   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.051s | Server load: 0.16 ]