#183137 - 2007-12-02 09:27 AM
Re: Copy/Moving files with folder creating
[Re: Witto]
|
Witto
MM club member
   
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
I did not test this!!! I think you want something like this
;************************************************************************* ; Script Name: MoveWavFiles ; Author: Wim Rotty ; Date: 1/12/2007 ; Description: Moves Wav files to directory with as name ; the creation date ;************************************************************************* ;Script Options If Not @LOGONMODE Break On Else Break Off EndIf Dim $RC $RC = SetOption("Explicit", "On") $RC = SetOption("NoMacrosInStrings", "On") $RC = SetOption("NoVarsInStrings", "On") If @SCRIPTEXE = "KIX32.EXE" $RC = SetOption("WrapAtEOL", "On") EndIf
;Declare Variables Dim $Directory, $DirInfo, $DirItem, $Destination Dim $Day, $Month, $Year
;Initialize Variables $Directory = 'C:\Program Files\VRL\Dep1\' $Destination = 'C:\Wav\'
;Code ;Check if target path exists If Not Exist($Destination) ;If not exists, create it MD $Destination ;If creation fails, just stop the script If @ERROR Exit @ERROR EndIf EndIf ;'/A-D' only searches for files ;'/F wav' searches for files with WAV extension $DirInfo = DirPlus($Directory,'/A-D /F wav') For Each $DirItem In $DirInfo ; '1. ' $DirItem.Path ? ; '2. ' $DirItem.Name ? ; '3. ' $DirItem.Drive ? ; '4. ' $DirItem.Type ? ; '5. ' $DirItem.DateCreated ? ; '6. ' $DirItem.DateLastAccessed ? ; '7. ' $DirItem.DateLastModified ? ; '8. ' $DirItem.Size ? ; "Date Created: " Split($DirItem.DateCreated," ")[0] ? $Day = Split(Split($DirItem.DateCreated," ")[0],"/")[0] If Len($Day) = 1 $Day = '0' + $Day EndIf ; "Day: " $Day ? $Month = Split(Split($DirItem.DateCreated," ")[0],"/")[1] If Len($Month) = 1 $Month = '0' + $Month EndIf ; "Month: " $Month ? $Year = Split(Split($DirItem.DateCreated," ")[0],"/")[2] ; "Year: " $Year ? ? ;Check if target folder with date exists If Not Exist($Destination+$Year+$Month+$Day+'\') ;If not exists, create it MD $Destination+$Year+$Month+$Day+'\' EndIf ;Move the file $DirItem.Move($Destination+$Year+$Month+$Day) Next
;If needed, Get $RC fakes a kind of pause ;so you get time to read the result window ;Get $RC
$DirItem = '' $DirInfo = ''
;Personal UDF Section
;UDF ;Paste here the DIRPlus UDF ;http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=82153 |
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 3139 anonymous users online.
|
|
|