Sort Files In Folders By Type...
#1
Posted 05 July 2008 - 11:36 PM
#2
Posted 06 July 2008 - 10:13 AM
file_find_first("C:\your\directory\here\*.mp3",0)Was that it or was there more to it?
#3
Posted 06 July 2008 - 01:14 PM
So, as celebraces has said, you would use file_find_first but you would set the path to your desired folder and specify your format with a *.FORMAT as this would find them all.
After this we would store the files into an array for easy identification.
Add this code into a script and execute the script via an object with the file folder and argument of the format you desire eg scr_sort("unsorted_folder","mp3","Destination_Folder")
f=file_find_first(working_directory+"\"+argument0+"\*."+argument1,"")
for(i=0;f!="";i+=1){
files[i]=f
f=file_find_next()
}
/*After we have listed all the files of a format we need to move them, so we take all the members of the array and copy them to a new folder.*/
for(j=0;j<i;j+=1){
file_rename(files[j],working_directory+"\"+argument2+"\"+string(i)+"."+argument1)
file_delete(files[j])
}
Edited by Pacninja, 06 July 2008 - 06:46 PM.
#4
Posted 06 July 2008 - 08:09 PM
doesnt seem to work ... and the script I've seen was a lot bigger though ...Actually, this script isn't too complicated, first off, you want to search for a certain format e.g.MP3
So, as celebraces has said, you would use file_find_first but you would set the path to your desired folder and specify your format with a *.FORMAT as this would find them all.
After this we would store the files into an array for easy identification.
Add this code into a script and execute the script via an object with the file folder and argument of the format you desire eg scr_sort("unsorted_folder","mp3","Destination_Folder")f=file_find_first(working_directory+"\"+argument0+"\*."+argument1,"") for(i=0;f!="";i+=1){ files[i]=f f=file_find_next() } /*After we have listed all the files of a format we need to move them, so we take all the members of the array and copy them to a new folder.*/ for(j=0;j<i;j+=1){ file_rename(files[j],working_directory+"\"+argument2+"\"+string(i)+"."+argument1) file_delete(files[j]) }
#6
Posted 07 July 2008 - 04:37 PM
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











