AutoHotkey Community

It is currently May 27th, 2012, 12:08 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: September 30th, 2009, 2:52 pm 
Offline

Joined: February 24th, 2006, 12:56 am
Posts: 172
hi!
i have two big folders that have same number of folders inside (200+, it depends from the case),i need to copy folder from one inside another
like this


FOLDER A FOLDER B
a1 <---- b1
a2 <---- b2
a3 <---- b3
.
.
.
.
a200<---- b200

i am viewing folders in the file manager, it sorts them alphabetically, i guess that is the problem...

thanks for the help!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 30th, 2009, 6:32 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
So this does not work :?
Code:
FileCopyDir,c:\temp\b1,c:\scratch\a1,1

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 1:53 pm 
Offline

Joined: February 24th, 2006, 12:56 am
Posts: 172
nope, this doesnt work..i guess i have to have loop there somewhere
any ideas?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 1:59 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
Do your have write access rights for that folder?

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 7:51 pm 
Offline

Joined: February 24th, 2006, 12:56 am
Posts: 172
yes i do...i dont know if i was clear about the problem...folder 1 from folder A needs to be copied to first folder of folder B. then 2nd A to 2nd B and so on...the way i am doing it now is manual..two folder panes and dragging them ;(

i know this could be done...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 4th, 2009, 8:58 pm 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I see.
Try something like this:
Code:
frompath=x:\1
topath=x:\A
;fileArray for "from" folder including folders, files and subfolders
Loop,%frompath%\*,1
   from .= (from ? "|" : "") A_LoopFileFullPath
Sort,from,d|
;Get first folder in "to" folder
Loop,%topath%\*,2
   to .= (to ? "|" : "") A_LoopFileFullPath
Sort,to,d| ;sort alphabetically
If InStr(to,"|")
   StringTrimRight,to,to,% StrLen(to)-InStr(to,"|")+1
Loop,Parse,from,|
{
   todir := to . SubStr(A_LoopField,0 - StrLen(A_LoopField) + InStr(A_LoopField,"\")+2)
   If !InStr(FileExist(A_LoopField),"D"){
      FileCopy,%A_LoopField%,%todir%,1
      Continue
   }
   If !InStr(FileExist(todir),"D")
      FileCreateDir, %todir%
   FileCopyDir,%A_LoopField%,%todir%,1
}

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2009, 3:22 pm 
Offline

Joined: February 24th, 2006, 12:56 am
Posts: 172
thanks for the effort, but it didnt work :(
i made a few folders to test it...
folder "books" contained three folders book1,book2 and book3
folder "templates" contained three folders as well template1,template2 and template 3

when i ran your script, with "from" being "templates" and to being "books"
i got new folder in folder "books" named book1EMP or something like that, with all three subfolders from folder "templates"

i played around and made this quick and dirty script:

Code:
frompath=D:\TEMP\images
topath=D:\TEMP\books

Loop, D:\TEMP\books\*.*,1
{
 
  path=%A_LoopFileFullPath%
 
  Loop, D:\TEMP\images\*.*,1
  {
   
   MsgBox, Folder to move: %A_LoopFileFullPath% where to move: %path%
   
   
   FileMoveDir, %A_LoopFileFullPath%, %path%\,1
   
   MsgBox, folder should be moved!
   break
   
  }
 
}


esc::ExitApp



it works BUT, since retrieving the folders is not sorted, i got messed up results...so book1 gets template3 or template2 folder which isnt what i want..i want book1 to receive template1 and for other folders as well.


how to do this??

thanks for help


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Google Feedfetcher, Leef_me, Pulover, rjgatito, XstatyK, Yahoo [Bot] and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group