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 

Advanced FileSort

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



Joined: 26 Feb 2008
Posts: 5

PostPosted: Thu Feb 28, 2008 1:34 pm    Post subject: Advanced FileSort Reply with quote

I need a script which searches all with .avi fileextension on one harddisk (recursive), and copies/moves them to a destination (FileSelectFolder)
, while recreating the folder structure from the source hard disk at the destination.
Many Movies are stored with meaningless names in directories, and the directory containing the movie files has the actual name of the movie, thats why I need the original folder structure copies/moves them too.


optional
*(if there are any double folders the script should rename the moved folder.)


is there ne1 who can help me....
Back to top
View user's profile Send private message
TheIrishThug



Joined: 19 Mar 2006
Posts: 381

PostPosted: Thu Feb 28, 2008 1:44 pm    Post subject: Reply with quote

For the scanning of the harddrive you will use Loop, FilePattern. This has a bunch of built in variables you can use to reconstruct the directory structure. I'm not sure exactly how that loop gets the file list, but it's probably a good idea to make sure it doesn't start looking in your destination folder.
Back to top
View user's profile Send private message Visit poster's website AIM Address
nerdz1



Joined: 26 Feb 2008
Posts: 5

PostPosted: Thu Feb 28, 2008 3:51 pm    Post subject: Reply with quote

@TheIrishThug, thank you for trying to help. but i need more then explaing a
single command.
Back to top
View user's profile Send private message
BoBoĻ
Guest





PostPosted: Thu Feb 28, 2008 4:03 pm    Post subject: Reply with quote

Quote:
but i need more then explaing a
single command.
What do you need?
Back to top
nerdz1



Joined: 26 Feb 2008
Posts: 5

PostPosted: Thu Feb 28, 2008 5:57 pm    Post subject: Reply with quote

a draft proposal how you guys would made it.
Back to top
View user's profile Send private message
wOxxOm



Joined: 09 Feb 2006
Posts: 319

PostPosted: Thu Feb 28, 2008 6:33 pm    Post subject: Reply with quote

certainly there are some freeware utilities that can do this, maybe KillCopy or something else. If you don't feel an affinity to experiment with AHK why bother scripting? Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website
nerdz1



Joined: 26 Feb 2008
Posts: 5

PostPosted: Fri Feb 29, 2008 1:10 pm    Post subject: Reply with quote

killcopy can not do it.
if there is a fw let me know.

i tested some tools that come close.

filesort
intelligent copierer

but they are not able to recreate the source folder struckture.
and thats the problem.
Back to top
View user's profile Send private message
tonne



Joined: 06 Jun 2006
Posts: 1259
Location: Denmark

PostPosted: Fri Feb 29, 2008 1:19 pm    Post subject: Reply with quote

xcopy comes with windows, I don't recall all the parameters but I use this
to make a copy of my usb drive (copies only new files):
xcopy x:\*.* c:\backup\x\ /D /E /K /O /H /Y
_________________
there's a dog barking close within the range of my ear
sounds like he wants to escape the chain
he would probably bite me to death if he could
but the chain lets me spit in his face

- Kashmir
Back to top
View user's profile Send private message
jonib



Joined: 09 May 2006
Posts: 66

PostPosted: Sat Mar 01, 2008 3:28 pm    Post subject: Reply with quote

Example code that seems to do what you want.

This one copies with full path:
Code:
InputVar=N:\Temp\Movies ; Directory where to start searching for files.
FileSelectFolder, OutputVar, , 3  ;This allows you to select what directory you want to move to.
Loop, %InputVar%\*.avi, , 1 ; Recursive search for *.avi files.
{
   IfNotInString, A_LoopFileDir, %OutputVar% ; Check that the directory is not in the destination directory.
   {
      StringTrimLeft, MovieDir, A_LoopFileDir, 3 ; Removes the drive letter (c:\).
      FileCreateDir, %OutputVar%\%MovieDir% ; Create destination directory.
      FileMoveDir, %A_LoopFileDir% , %OutputVar%\%MovieDir%, 2 ; Move the dir to the selected directory.
   }
}

This one copies only the directory where the .avi file is:
Code:
InputVar=N:\Temp\Movies ; Directory where to start searching for files.
FileSelectFolder, OutputVar, , 3  ;This allows you to select what directory you want to move to.
Loop, %InputVar%\*.avi, , 1 ; Recursive search for *.avi files.
{
   IfNotInString, A_LoopFileDir, %OutputVar% ; Check that the directory is not in the destination directory.
   {
      Loop, Parse, A_LoopFileDir , \
         MovieDir=%A_LoopField% ; Get the last part of the path
      FileMoveDir, %A_LoopFileDir% , %OutputVar%\%MovieDir%, 2 ; Move the dir to the selected directory.
   }
}

In both examples you need to change InputVar to point to where to start to scan for your .AVI files.
Edit: Both scripts will move files so better to test with copies first.
Back to top
View user's profile Send private message
nerdz1



Joined: 26 Feb 2008
Posts: 5

PostPosted: Sat Mar 01, 2008 6:23 pm    Post subject: Reply with quote

hey thanks to to all who tried to help me.

especially jonib.

the script does move the unwanted file extensions too.
Back to top
View user's profile Send private message
jonib



Joined: 09 May 2006
Posts: 66

PostPosted: Mon Mar 03, 2008 3:34 am    Post subject: Reply with quote

nerdz1 wrote:
the script does move the unwanted file extensions too.

If you only want to move .AVI files change the "FileMoveDir" command to:
Code:
FileMove, %A_LoopFileLongPath%, %OutputVar%\%MovieDir%


jonib
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