AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Filecopy Help!

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
alantsd



Joined: 26 Oct 2007
Posts: 10

PostPosted: Fri Oct 26, 2007 11:14 am    Post subject: Filecopy Help! Reply with quote

Hi i'm newbee in AHK...
I wish to backup all my Homeworks in pendrive to my document folder.
All my Homeworks are organised in folder...there are 100++ folders..
The folder's name will be changed daily...and some got form my friends


So i like to code a hotkey that can copy all of my file + file in folder to my document....

But Sometimes i can't copy the file in folder if i dun know the name of folder.
I need to change my code every there's is a new folder ......and compile
Does anyone knows how to copy every things in pendrives include File within folder as well?
*******************************************************
Code:
#SingleInstance off
Loop,
{
IfExist, E:\
    Run E:\  ;open my pendrive
    FileCopy, E:\*.*, %A_MyDocuments%\My Music  ;backing up my works
    FileCopy, E:\Books\*.pdf , %A_MyDocuments%\My Music
    FileCopy, E:\Homeworks\*.Doc, %A_MyDocuments%\My Music
    FileCopy, E:\Songs\*.mp3, %A_MyDocuments%\My Music
    FileCopy, E:\Lectures\*.ppt, %A_MyDocuments%\My Music
    FileCopy, E:\Chemistry\*.*, %A_MyDocuments%\My Music
         
         ↓
         ↓          ;too many to list .....help me out
 
FileSetAttrib, +R, A_MyDocuments%\My Music\*.*, 1
sleep, 180000
SoundBeep, 950, 500
if WinActive("ahk_class #32770") ;endtask if pendrive is about to be removed.
    ExitApp     
}
#Q::ExitApp



********************************************************

Can i use the wildcards or others method to do like this?

Filecopy,E:\????????\*.*, %A_MyDocuments%\My Music

I know it is not going to work....


Last edited by alantsd on Sat Oct 27, 2007 7:33 am; edited 2 times in total
Back to top
View user's profile Send private message
Leon



Joined: 27 Aug 2007
Posts: 179

PostPosted: Fri Oct 26, 2007 5:04 pm    Post subject: Reply with quote

Maybe i misunderstood the problem but couldn't u just mirror the folder structure of MyDocs in a folder on E also caled MyDocs?
then use FileCopyDir with a flag of 1 to overwrite?
Back to top
View user's profile Send private message
alantsd



Joined: 26 Oct 2007
Posts: 10

PostPosted: Sat Oct 27, 2007 7:37 am    Post subject: Reply with quote

Leon (formerly Leofola) wrote:
Maybe i misunderstood the problem but couldn't u just mirror the folder structure of MyDocs in a folder on E also caled MyDocs?
then use FileCopyDir with a flag of 1 to overwrite?


Thanks ...but
Sometimes ...i like to copy my friends's pendrive...other than mine...
Then the above code won't work any more....

is there any way to copy the whole content of pendrive regardless of folder's name?
Back to top
View user's profile Send private message
Leon



Joined: 27 Aug 2007
Posts: 179

PostPosted: Sun Oct 28, 2007 11:05 am    Post subject: Reply with quote

If you want to keep the files you copy in their original folder structure (i would) then u won't need a loop.
In which case the code below would do what u want quick and easy.

If you want them all as loose files for some reason, let me know and I'll do something else (time permitting) or point u in the right direction.

You could add #d after paste so that u get your screen back but it would slow down the copy a lot by taking focus off the copy window.
Probably not good as u seem to have a lot to copy.

Code:
#SingleInstance, Force                            ;purely my preference
SetTitleMatchMode 2
SetTitleMatchMode Slow
Pen = Y:                                          ;swap for the letter you need
mDocs = %A_MyDocuments%
Run, %Pen%
;WinWaitActive, (%Pen%) ahk_class CabinetWClass   ;uncomment if necessary. Probably won't be
Send, {CTRLDOWN}a{CTRLUP}                         ;See "NOTE" in post
Send, {AppsKey}nmm{ENTER}                         ;If you really want them in MyMusic, remove this line and /* and */
/*
Send, {CTRLDOWN}c{CTRLUP}
Run, %mDocs%\My Music
WinActivate, %mDocs%\My Music
Sleep, 1000
Send, {CTRLDOWN}v{CTRLUP}
*/

NOTE: Usually i prefer to use WinMenuSelectItem for anything that can be found in the menu, but strangely that wasn't working. Never tried it on an explorer window before tho
Back to top
View user's profile Send private message
svi



Joined: 09 Oct 2006
Posts: 126
Location: Finland

PostPosted: Sun Oct 28, 2007 9:15 pm    Post subject: Reply with quote

Leon wrote:

NOTE: Usually i prefer to use WinMenuSelectItem for anything that can be found in the menu, but strangely that wasn't working. Never tried it on an explorer window before tho


I had same result few days ago trying to use WinMenuSelectItem in Explorer Confused
_________________
Pekka Vartto
Back to top
View user's profile Send private message
YMP



Joined: 23 Dec 2006
Posts: 266
Location: Russia

PostPosted: Mon Oct 29, 2007 5:50 am    Post subject: Reply with quote

Things are not always what they look like. Explorer's menu bar is actually a toolbar.
WinMenuSelectItem wrote:

This command will not work with applications that use non-standard menu bars. Examples include Microsoft Outlook and Outlook Express, which use disguised toolbars for their menu bars. In these cases, consider using ControlSend or PostMessage , which should be able to interact with some of these non-standard menu bars.
Back to top
View user's profile Send private message
svi



Joined: 09 Oct 2006
Posts: 126
Location: Finland

PostPosted: Mon Oct 29, 2007 11:38 pm    Post subject: Reply with quote

YMP wrote:
Explorer's menu bar is actually a toolbar.
... which means that it's a control, and it can be moved, resized, closed or hidden (just for curiosity).
_________________
Pekka Vartto
Back to top
View user's profile Send private message
alantsd



Joined: 26 Oct 2007
Posts: 10

PostPosted: Thu Nov 01, 2007 12:39 pm    Post subject: Reply with quote

Leon wrote:
If you want to keep the files you copy in their original folder structure (i would) then u won't need a loop.
In which case the code below would do what u want quick and easy.

If you want them all as loose files for some reason, let me know and I'll do something else (time permitting) or point u in the right direction.

You could add #d after paste so that u get your screen back but it would slow down the copy a lot by taking focus off the copy window.
Probably not good as u seem to have a lot to copy.

Code:
#SingleInstance, Force                            ;purely my preference
SetTitleMatchMode 2
SetTitleMatchMode Slow
Pen = Y:                                          ;swap for the letter you need
mDocs = %A_MyDocuments%
Run, %Pen%
;WinWaitActive, (%Pen%) ahk_class CabinetWClass   ;uncomment if necessary. Probably won't be
Send, {CTRLDOWN}a{CTRLUP}                         ;See "NOTE" in post
Send, {AppsKey}nmm{ENTER}                         ;If you really want them in MyMusic, remove this line and /* and */
/*
Send, {CTRLDOWN}c{CTRLUP}
Run, %mDocs%\My Music
WinActivate, %mDocs%\My Music
Sleep, 1000
Send, {CTRLDOWN}v{CTRLUP}
*/

NOTE: Usually i prefer to use WinMenuSelectItem for anything that can be found in the menu, but strangely that wasn't working. Never tried it on an explorer window before tho




Thanks for your help....
But i prefer command base action....
Alt-a and copy and paste ...can do it ..but some how i find it not suitable.....

using command.. i found out there is no way that the ahk can copy all folders and files

what i found out was ...using 7zip.exe
as long as it can backup all my files and folder is good enough for me.....
thanks to all my friends!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group