Skip to content

Commit d6da276

Browse files
Add Downloads Sorter script for organizing files
1 parent b67065b commit d6da276

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

examples/downloads_sorter.do

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# === Downloads Sorter (DoScript v0.6) ===
2+
3+
log "Starting Downloads sorter..."
4+
5+
global_variable = downloads
6+
downloads = "C:/Users/User/Downloads"
7+
8+
# --- Ensure target folders exist ---
9+
make folder '{downloads}/exe'
10+
make folder '{downloads}/zip'
11+
make folder '{downloads}/images'
12+
make folder '{downloads}/docs'
13+
make folder '{downloads}/other'
14+
15+
# --- Loop through files recursively ---
16+
for_each file_in deep
17+
18+
# skip folders using metadata-safe trick
19+
if file_is_dir == true
20+
continue
21+
end_if
22+
23+
if_ends_with ".exe"
24+
move file to '{downloads}/exe/{file}'
25+
end_if
26+
27+
if file_ext == ".zip" or file_ext == ".rar" or file_ext == ".7z"
28+
move file to '{downloads}/zip/{file}'
29+
end_if
30+
31+
if file_ext == ".png" or file_ext == ".jpg" or file_ext == ".jpeg" or file_ext == ".gif"
32+
move file to '{downloads}/images/{file}'
33+
end_if
34+
35+
if file_ext == ".pdf" or file_ext == ".docx" or file_ext == ".txt"
36+
move file to '{downloads}/docs/{file}'
37+
end_if
38+
39+
if file_ext != ".exe" and file_ext != ".zip" and file_ext != ".rar" and file_ext != ".7z" and file_ext != ".png" and file_ext != ".jpg" and file_ext != ".jpeg" and file_ext != ".gif" and file_ext != ".pdf" and file_ext != ".docx" and file_ext != ".txt"
40+
move file to '{downloads}/other/{file}'
41+
end_if
42+
43+
end_for
44+
45+
log "Downloads sorting complete."

0 commit comments

Comments
 (0)