| View previous topic :: View next topic |
| Author |
Message |
nerdz1
Joined: 26 Feb 2008 Posts: 5
|
Posted: Thu Feb 28, 2008 1:34 pm Post subject: Advanced FileSort |
|
|
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 |
|
 |
TheIrishThug
Joined: 19 Mar 2006 Posts: 381
|
Posted: Thu Feb 28, 2008 1:44 pm Post subject: |
|
|
| 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 |
|
 |
nerdz1
Joined: 26 Feb 2008 Posts: 5
|
Posted: Thu Feb 28, 2008 3:51 pm Post subject: |
|
|
@TheIrishThug, thank you for trying to help. but i need more then explaing a
single command. |
|
| Back to top |
|
 |
BoBoĻ Guest
|
Posted: Thu Feb 28, 2008 4:03 pm Post subject: |
|
|
| Quote: | but i need more then explaing a
single command. | What do you need? |
|
| Back to top |
|
 |
nerdz1
Joined: 26 Feb 2008 Posts: 5
|
Posted: Thu Feb 28, 2008 5:57 pm Post subject: |
|
|
| a draft proposal how you guys would made it. |
|
| Back to top |
|
 |
wOxxOm
Joined: 09 Feb 2006 Posts: 319
|
Posted: Thu Feb 28, 2008 6:33 pm Post subject: |
|
|
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?  |
|
| Back to top |
|
 |
nerdz1
Joined: 26 Feb 2008 Posts: 5
|
Posted: Fri Feb 29, 2008 1:10 pm Post subject: |
|
|
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 |
|
 |
tonne
Joined: 06 Jun 2006 Posts: 1259 Location: Denmark
|
Posted: Fri Feb 29, 2008 1:19 pm Post subject: |
|
|
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 |
|
 |
jonib
Joined: 09 May 2006 Posts: 66
|
Posted: Sat Mar 01, 2008 3:28 pm Post subject: |
|
|
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 |
|
 |
nerdz1
Joined: 26 Feb 2008 Posts: 5
|
Posted: Sat Mar 01, 2008 6:23 pm Post subject: |
|
|
hey thanks to to all who tried to help me.
especially jonib.
the script does move the unwanted file extensions too. |
|
| Back to top |
|
 |
jonib
Joined: 09 May 2006 Posts: 66
|
Posted: Mon Mar 03, 2008 3:34 am Post subject: |
|
|
| 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 |
|
 |
|