set thesource to quoted form of POSIX path of (choose folder)
set thedestination to quoted form of POSIX path of (choose folder)
set thesuffix to "'*.jpg'"
set thelist to get_folder_and_file_list(thesuffix, thesource)
set filecount to count of every paragraph of item 2 of thelist
display dialog filecount & " files have been moved" as text
make_folders_of_list(thedestination, every paragraph of (item 1 of thelist))
move_files_to_folders(thesource, thedestination, every paragraph of (item 2 of thelist))
on move_files_to_folders(thesource_folder, destination_folder, filelist)
repeat with thefile in filelist
do shell script "cd " & destination_folder & ";mv " & thesource_folder & quoted form of thefile & " " & quoted form of thefile
end repeat
end move_files_to_folders
on make_folders_of_list(destination_folder, folderlist)
repeat with thefolderpath in folderlist
do shell script "cd " & destination_folder & ";mkdir -p " & quoted form of thefolderpath
end make_folders_of_list
on get_folder_and_file_list(searchstring, folder2search)
set folderlist to do shell script "cd " & folder2search & ";find . -iname " & searchstring & " -exec dirname {} \\;"
set filelist to do shell script "cd " & folder2search & ";find . -name " & searchstring
return {folderlist, filelist}
end get_folder_and_file_list
Your email is never published nor shared. Required fields are marked *
You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
CAPTCHA: two − 1 =
Notify me of followup comments via e-mail
Subscribe without commenting E-Mail:
Dateien eines bestimmten Typs verschieben und Ordnerstruktur dabei beibehalten
set thesource to quoted form of POSIX path of (choose folder)
set thedestination to quoted form of POSIX path of (choose folder)
set thesuffix to "'*.jpg'"
set thelist to get_folder_and_file_list(thesuffix, thesource)
set filecount to count of every paragraph of item 2 of thelist
display dialog filecount & " files have been moved" as text
make_folders_of_list(thedestination, every paragraph of (item 1 of thelist))
move_files_to_folders(thesource, thedestination, every paragraph of (item 2 of thelist))
on move_files_to_folders(thesource_folder, destination_folder, filelist)
repeat with thefile in filelist
do shell script "cd " & destination_folder & ";mv " & thesource_folder & quoted form of thefile & " " & quoted form of thefile
end repeat
end move_files_to_folders
on make_folders_of_list(destination_folder, folderlist)
repeat with thefolderpath in folderlist
do shell script "cd " & destination_folder & ";mkdir -p " & quoted form of thefolderpath
end repeat
end make_folders_of_list
on get_folder_and_file_list(searchstring, folder2search)
set folderlist to do shell script "cd " & folder2search & ";find . -iname " & searchstring & " -exec dirname {} \\;"
set filelist to do shell script "cd " & folder2search & ";find . -name " & searchstring
return {folderlist, filelist}
end get_folder_and_file_list