-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEzPiz.py
1610 lines (1458 loc) · 99.9 KB
/
EzPiz.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python
try:
import os
import zipfile
import sys
import os.path
import time
import datetime
import psutil
import random
except ImportError:
print("Some required modules are not installed, would you like to install them? (y/n)")
answer = input()
if answer == 'y':
import pip
pip.main(['install', 'os'])
pip.main(['install', 'zipfile'])
pip.main(['install', 'sys'])
pip.main(['install', 'os.path'])
pip.main(['install', 'time'])
pip.main(['install', 'datetime'])
pip.main(['install', 'psutil'])
pip.main(['install', 'random'])
os.system("cls")
print(
"The Moduls should be installed, skript will restart in 3 seconds.")
time.sleep(3)
os.system("cls")
os.system("python EzPiz.py")
else:
print("Das Skript wird beendet.")
time.sleep(2)
exit()
# ==================================================================================================
# ==================================================================================================
# ====================================== INFO TXT ==================================================
# ==================================================================================================
# ==================================================================================================
# EzPiz Menu
# By: wolFzk1nD
Version = "0.0.1 aplha"
skName = os.path.basename(__file__)
#Info text :)
info = f'''
EzPiz Menu
by wolFzk1nD
Version: {Version}
THIS IS A ALPHA VERSION, SO THERE MIGHT BE BUGS AND ERRORS
YOU HAVE TO RUN THIS WITH ADMIN RIGHTS, OR IT WILL NOT WORK
Originally created for the Raspberry Pi using Raspian OS (Debianbased)
Menu provides a simple way to manage your Pi's / Servers Files and to run scripts.
Inside Manager menu, you can use shortcuts to navigate through the menu.
e.X: type 'fast' instead of the index number to fast travel to a custom path.
Type X to toggle between always showing files and folders ON/OFF
Type D to toggle between showing the Designmode on ASCIIS ON/OFF
Type 0 or q to go back one step in the menu.
Manager = Manage Files and Folders
fast = Fast Travel to a custom path
list = List all files in current path
find = Find a file or folder by name
create = Create a file or folder
read = Read a file
rename = Rename a file/s or folder/s
move = Move a file/s or folder/s
copy = Copy a file/s or folder/s
delete = Delete a file/s or folder/s
zip = Zip a file/s or folder/s
unzip = Unzip a zipfile
ch = Change current path into folder in current path
rsync = Create a Backup of a file or folder to custom path
Scripts = Run Scripts
Add your own paths to the script_path variable to add them into the menu.
Add extensions if it's not in the list for extensions.
Scripts will be always run as ROOT, due this script is run as ROOT.
Admin/Commands = Run Commands
Add your own commands to the custom_cmd variable to add them into the menu.
Monitor Stats = Switch to a mode, that only shows the stats window and refresh every X seconds.
5. and 6. are just fpr faster access, Fast Travel and RSYNC Backup
Show all ASCII colormodes = Prints out a example for all colormodes for ASCII arts
This script is still in development and is for sure not the best code!
I am a learner, not a pro coder, so please be patient with me.
If you have improvements, feel free to let me know or share your version of the code
This project has been created for personal use, but i decided to share it with the world.
Thanks to all,
w0lFzk1nD
14/12/2022'''
# ==================================================================================================
# ==================================================================================================
# =======================================SETTINGS===================================================
# ==================================================================================================
# ==================================================================================================
#Here you will setup your paths and files.
#You can also change the look of the ascii arts and toggle the 2 options ON/OFF
global logo_mode
global title_mode
global show_mode
global show_files
# Change this to change the look of the ascii art (r: random, 1-5 randomstages, 5 highest)
# r 1 2 3 4 5 blizzard acid hacker love death raw rainbow gay circus ocean forest space romance night desert sunset neon
logo_mode = "hacker"
title_mode = "hacker"
show_mode = False
show_files = False
# current path to script file
path_to_menuscript = os.path.dirname(os.path.realpath(__file__)) + "/"+skName
# Custom path for fast travel and file stuff
# Customize as you want
# Example /home/pi/Desktop/Code
paths = ['/Your/Path/Here',]
# ADMIN Custom Commands
custom_cmd = ['apt-get update',]
# Custom script paths
script_path = "/Path/To/Your/Scripts/"
filetypes = {'sh': 'bash', 'py': 'python3', 'js': 'node'}
filenames = ['dancing_cats.py',]
# Paths to foles or folders you want to backup
backup_data = ["/Path/To/Your/Things/",]
# Paths to backup to
destinations = ["/Path/To/Folder/To/Backup/To/",]
# Super cool ascii arts, its recommended to minimize this, when working in the Code
asciis = {
'logo': '''\n@@@@@@@@ @@@@@@@@ @@@@@@@ @@@ @@@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@ @@@@@@@@ \n@@! @@! @@! @@@ @@! @@! \n!@! !@! !@! @!@ !@! !@! \n@!!!:! @!! @!@@!@! !!@ @!! \n!!!!!: !!! !!@!!! !!! !!! \n!!: !!: !!: !!: !!: \n:!: :!: :!: :!: :!: \n :: :::: :: :::: :: :: :: :::: \n: :: :: : :: : : : : : :: : : \n\n >=======[ VERSION: ''' + Version + ''' ]=======<\n''',
'main': '''@@@@@@@@@@ @@@@@@ @@@ @@@ @@@ \n@@@@@@@@@@@ @@@@@@@@ @@@ @@@@ @@@ \n@@! @@! @@! @@! @@@ @@! @@!@!@@@ \n!@! !@! !@! !@! @!@ !@! !@!!@!@! \n@!! !!@ @!@ @!@!@!@! !!@ @!@ !!@! \n!@! ! !@! !!!@!!!! !!! !@! !!! \n!!: !!: !!: !!! !!: !!: !!! \n:!: :!: :!: !:! :!: :!: !:! \n::: :: :: ::: :: :: :: \n : : : : : : :: : \n ''',
'manager': ''' @@@@@@@@@@ @@@ @@@ @@@@@@@@ @@@@@@@ \n@@@@@@@@@@@ @@@@ @@@ @@@@@@@@@ @@@@@@@@ \n@@! @@! @@! @@!@!@@@ !@@ @@! @@@ \n!@! !@! !@! !@!!@!@! !@! !@! @!@ \n@!! !!@ @!@ @!@ !!@! !@! @!@!@ @!@!!@! \n!@! ! !@! !@! !!! !!! !!@!! !!@!@! \n!!: !!: !!: !!! :!! !!: !!: :!! \n:!: :!: :!: !:! :!: !:: :!: !:! \n::: :: :: :: ::: :::: :: ::: \n : : :: : :: :: : : : :\n\n MANAGE FILES / FODLERS''',
'bash': '''@@@@@@@ @@@ @@@@@@ @@@ @@@ \n@@@@@@@@ @@@@ @@@@@@@ @@@ @@@ \n@@! @@@ @@!@! !@@ @@! @@@ \n!@ @!@ !@!!@! !@! !@! @!@ \n@!@!@!@ @!! @!! !!@@!! @!@!@!@! \n!!!@!!!! !!! !@! !!@!!! !!!@!!!! \n!!: !!! :!!:!:!!: !:! !!: !!! \n:!: !:! !:::!!::: !:! :!: !:! \n :: :::: ::: :::: :: :: ::: \n:: : :: ::: :: : : : : :\n\n RUN CUSTOM SCRIPTS''',
'admin': ''' @@@@@@ @@@@@@@ @@@@@@@@@@ @@@ @@@ @@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@@@@@ @@@ @@@@ @@@ \n@@! @@@ @@! @@@ @@! @@! @@! @@! @@!@!@@@ \n!@! @!@ !@! @!@ !@! !@! !@! !@! !@!!@!@! \n@!@!@!@! @!@ !@! @!! !!@ @!@ !!@ @!@ !!@! \n!!!@!!!! !@! !!! !@! ! !@! !!! !@! !!! \n!!: !!! !!: !!! !!: !!: !!: !!: !!! \n:!: !:! :!: !:! :!: :!: :!: :!: !:! \n:: ::: :::: :: ::: :: :: :: :: \n : : : :: : : : : : :: :\n\n CONSOLE COMMANDS''',
'rsync': '''@@@@@@@ @@@@@@ @@@ @@@ @@@ @@@ @@@@@@@ \n@@@@@@@@ @@@@@@@ @@@ @@@ @@@@ @@@ @@@@@@@@ \n@@! @@@ !@@ @@! !@@ @@!@!@@@ !@@ \n!@! @!@ !@! !@! @!! !@!!@!@! !@! \n@!@!!@! !!@@!! !@!@! @!@ !!@! !@! \n!!@!@! !!@!!! @!!! !@! !!! !!! \n!!: :!! !:! !!: !!: !!! :!! \n:!: !:! !:! :!: :!: !:! :!: \n:: ::: :::: :: :: :: :: ::: ::: \n : : : :: : : : :: : :: :: :\n\n CREATE BACKUPS''',
'find': '''@@@@@@@@ @@@ @@@ @@@ @@@@@@@ \n@@@@@@@@ @@@ @@@@ @@@ @@@@@@@@ \n@@! @@! @@!@!@@@ @@! @@@ \n!@! !@! !@!!@!@! !@! @!@ \n@!!!:! !!@ @!@ !!@! @!@ !@! \n!!!!!: !!! !@! !!! !@! !!! \n!!: !!: !!: !!! !!: !!! \n:!: :!: :!: !:! :!: !:! \n :: :: :: :: :::: :: \n : : :: : :: : : \n\n FIND FILES/FOLDERS''',
'copy': ''' @@@@@@@ @@@@@@@ @@@@@@@ @@@ @@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@ @@@ @@@@@@@@ \n!@@ @@! @@@ @@! @@! @@! !@@ \n!@! !@! @!@ !@! !@! !@! !@! \n!@! @!@!!@! @!! @!! @!@!@!@!@ !@! \n!!! !!@!@! !!! !!! !!!@!@!!! !!! \n:!! !!: :!! !!: !!: !!: :!! \n:!: :!: !:! :!: :!: :!: :!: \n ::: ::: :: ::: :: :: :::: ::: ::: \n :: :: : : : : : : :: : : :: :: :\n\n COPY FILES/FOLDERS''',
'delete': '''@@@ @@@ @@@@@@@@ @@@@@@@@ @@@@@@@ \n@@@ @@@ @@@@@@@@ @@@@@@@@ @@@@@@@ \n@@! !@@ @@! @@! @@! \n!@! @!! !@! !@! !@! \n !@!@! @!!!:! @!!!:! @!! \n @!!! !!!!!: !!!!!: !!! \n !!: !!: !!: !!: \n :!: :!: :!: :!: \n :: :: :::: :: :::: :: \n : : :: :: : :: :: :\nDELETE FILES/FOLDERS''',
'rename': '''@@@@@@@ @@@@@@@@ @@@ @@@ @@@@@@ @@@@@@@@@@ @@@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@ @@@ @@@@@@@@ @@@@@@@@@@@ @@@@@@@@ \n@@! @@@ @@! @@!@!@@@ @@! @@@ @@! @@! @@! @@! \n!@! @!@ !@! !@!!@!@! !@! @!@ !@! !@! !@! !@! \n@!@!!@! @!!!:! @!@ !!@! @!@!@!@! @!! !!@ @!@ @!!!:! \n!!@!@! !!!!!: !@! !!! !!!@!!!! !@! ! !@! !!!!!: \n!!: :!! !!: !!: !!! !!: !!! !!: !!: !!: \n:!: !:! :!: :!: !:! :!: !:! :!: :!: :!: \n:: ::: :: :::: :: :: :: ::: ::: :: :: :::: \n : : : : :: :: :: : : : : : : : :: ::\n\n REANME FILE / FOLDER''',
'move': '''@@@@@@@@@@ @@@@@@ @@@ @@@ @@@@@@@@ \n@@@@@@@@@@@ @@@@@@@@ @@@ @@@ @@@@@@@@ \n@@! @@! @@! @@! @@@ @@! @@@ @@! \n!@! !@! !@! !@! @!@ !@! @!@ !@! \n@!! !!@ @!@ @!@ !@! @!@ !@! @!!!:! \n!@! ! !@! !@! !!! !@! !!! !!!!!: \n!!: !!: !!: !!! :!: !!: !!: \n:!: :!: :!: !:! ::!!:! :!: \n::: :: ::::: :: :::: :: :::: \n : : : : : : : :: ::\n MOVE FILE / FOLDER''',
'fasttravel': '''@@@@@@@@ @@@@@@ @@@@@@ @@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@ \n@@! @@! @@@ !@@ @@! \n!@! !@! @!@ !@! !@! \n@!!!:! @!@!@!@! !!@@!! @!! \n!!!!!: !!!@!!!! !!@!!! !!! \n!!: !!: !!! !:! !!: \n:!: :!: !:! !:! :!: \n :: :: ::: :::: :: :: \n : : : : :: : : : \n \n @@@@@@@ @@@@@@@ @@@ @@@ @@@ \n @@@@@@@ @@@@@@@@ @@@ @@@ @@@ \n @@! @@! @@@ @@! @@@ @@! \n !@! !@! @!@ !@! @!@ !@! \n @!! @!@!!@! @!@ !@! @!! \n !!! !!@!@! !@! !!! !!! \n !!: !!: :!! :!: !!: !!: \n :!: :!: !:! ::!!:! :!: \n :: :: ::: :::: :: :::: \n : : : : : : :: : : \n\n FAST TRAVEL TO CUSTOM PATHS''',
'txt': ''' @@@@@@@ @@@@@@@ @@@@@@@@ @@@@@@ @@@@@@@ @@@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@ @@@@@@@@ \n!@@ @@! @@@ @@! @@! @@@ @@! @@! \n!@! !@! @!@ !@! !@! @!@ !@! !@! \n!@! @!@!!@! @!!!:! @!@!@!@! @!! @!!!:! \n!!! !!@!@! !!!!!: !!!@!!!! !!! !!!!!: \n:!! !!: :!! !!: !!: !!! !!: !!: \n:!: :!: !:! :!: :!: !:! :!: :!: \n ::: ::: :: ::: :: :::: :: ::: :: :: :::: \n :: :: : : : : : :: :: : : : : : :: :: \n\n CREATE FILE / FOLDER''',
'read': '''@@@@@@@ @@@@@@@@ @@@@@@ @@@@@@@ \n@@@@@@@@ @@@@@@@@ @@@@@@@@ @@@@@@@@ \n@@! @@@ @@! @@! @@@ @@! @@@ \n!@! @!@ !@! !@! @!@ !@! @!@ \n@!@!!@! @!!!:! @!@!@!@! @!@ !@! \n!!@!@! !!!!!: !!!@!!!! !@! !!! \n!!: :!! !!: !!: !!! !!: !!! \n:!: !:! :!: :!: !:! :!: !:! \n:: ::: :: :::: :: ::: :::: :: \n : : : : :: :: : : : :: : : \n\n READ KONTEXT OF A FILE''',
'dir': ''' @@@@@@@ @@@ @@@ @@@@@@@ @@@ @@@@@@@ \n@@@@@@@@ @@@ @@@ @@@@@@@@ @@@ @@@@@@@@ \n!@@ @@! @@@ @@! @@@ @@! @@! @@@ \n!@! !@! @!@ !@! @!@ !@! !@! @!@ \n!@! @!@!@!@! @!@ !@! !!@ @!@!!@! \n!!! !!!@!!!! !@! !!! !!! !!@!@! \n:!! !!: !!! !!: !!! !!: !!: :!! \n:!: :!: !:! :!: !:! :!: :!: !:! \n ::: ::: :: ::: :::: :: :: :: ::: \n :: :: : : : : :: : : : : : : \n\n CHANGE DIRECTORY''',
'zip': '''@@@@@@@@ @@@ @@@@@@@ \n@@@@@@@@ @@@ @@@@@@@@ \n @@! @@! @@! @@@ \n !@! !@! !@! @!@ \n @!! !!@ @!@@!@! \n !!! !!! !!@!!! \n !!: !!: !!: \n:!: :!: :!: \n :: :::: :: :: \n: :: : : : : \nZIP FILES/FOLDERS''',
'unzip': '''@@@ @@@ @@@ @@@ @@@@@@@@ @@@ @@@@@@@ \n@@@ @@@ @@@@ @@@ @@@@@@@@ @@@ @@@@@@@@ \n@@! @@@ @@!@!@@@ @@! @@! @@! @@@ \n!@! @!@ !@!!@!@! !@! !@! !@! @!@ \n@!@ !@! @!@ !!@! @!! !!@ @!@@!@! \n!@! !!! !@! !!! !!! !!! !!@!!! \n!!: !!! !!: !!! !!: !!: !!: \n:!: !:! :!: !:! :!: :!: :!: \n::::: :: :: :: :: :::: :: :: \n : : : :: : : :: : : : : \n\n UNZIP ZIPFILE''',
'bye0': '''\n * * * *\n *** ********** ***\n ***** ********** *****\n ******* ********** *******\n ********** ************ **********\n ****************************************************\n ******************************************************\n********************************************************\n********************************************************\n********************************************************\n ******************************************************\n ******** ************************ ********\n ******* * ********* * *******\n ****** ******* ******\n ***** ***** *****\n *** *** ***\n ** * **\n __________\n \______ \___.__. ____.\n | | _< | |/ __ \.\n | | \.\___ \ ___/.\n |______ // ____|\___ >.\n \/ \/ \/.''',
'bye1': '''\n ,-""""""-.\n /\j__/\ ( \`--.\n \`@_@'/ _) >--.`.\n _{.:Y:_}_{{_,' ) )\n {_}`-^{_} ``` (_/\n __________\n \______ \___.__. ____.\n | | _< | |/ __ \.\n | | \.\___ \ ___/.\n |______ // ____|\___ >.\n \/ \/ \/.''',
'bye2': '''\n@@@@@@@ @@@ @@@ @@@@@@@@ \n@@@@@@@@ @@@ @@@ @@@@@@@@ \n@@! @@@ @@! !@@ @@! \n!@ @!@ !@! @!! !@! \n@!@!@!@ !@!@! @!!!:! \n!!!@!!!! @!!! !!!!!: \n!!: !!! !!: !!: \n:!: !:! :!: :!: \n :: :::: :: :: :::: \n:: : :: : : :: :: ''',
'bye3': '''\n @@@@@@@ @@@ @@@ @@@@@@ \n@@@@@@@@ @@@ @@@ @@@@@@@@ \n!@@ @@! !@@ @@! @@@ \n!@! !@! @!! !@! @!@ \n!@! !@!@! @!@!@!@! \n!!! @!!! !!!@!!!! \n:!! !!: !!: !!! \n:!: :!: :!: !:! \n ::: ::: :: :: ::: \n :: :: : : : : :''',
'bye4': '''\n @@! !@@ \n !@! @!! \n@!@ !@@!@! \n!@! @!@!@!!@!! \n:!: !: :!! \n :!: !:! \n:!: ::: ::: \n :: \n::''',
'bye5': '''\n \n __,__\n .--. .-" "-. .--.\n / .. \/ .-. .-. \/ .. \.\n | | '| / Y \ |' | |\n | \ \ \ 0 | 0 / / / |\n \ '- ,\.-"`` ``"-./, -' /\n `'-' /_ ^ ^ _\ '-'`\n | \._ _./ |\n \ \ `~` / /\n '._ '-=-' _.'\n '~---~''',
'bye6': '''\n ||\n ||\n _;|\n /__3\n / /||\n / / // .--.\n \ \// / (OO)\n \// |( _ )\n // \__/`-'\__\n // \__ _ \.\n _.-'/ | ._._.|\ \.\n(_.-' | \ \ \.\n .-._ / o ) / /\n /_ \ \ / \__/ / /\n \ \_/ / / E_/\n \ / /\n `-._/-' ''',
'bye7': '''\n _\n ,.-" "-.,\n / === \.\n / ======= \.\n __| (o) (0) |__ \n / _| .---. |_ \ \n | /.----/ O O \----.\ | \n \/ | | \/ \n | | \n | | \n | | \n _\ -.,_____,.- /_ \n ,.-" "-.,_________,.-" "-.,\n / | | \ \n| l. .l | \n| | | |\nl. | | .l \n | l. .l | \, \n l. | | .l \, \n | | | | \, \n l. | | .l |\n | | | | |\n | |---| | |\n | | | | |\n /"-.,__,.-"\ /"-.,__,.-"\"-.,_,.-"\.\n | \ / | |\n | | | |\n \__|__|__|__/ \__|__|__|__/ \_|__|__/ ''',
'bye8': '''\n |\ _,,,---,,_\nZZZzz /,`.-'`' -. ;-;;,_\n |,4- ) )-,_. ,\ ( `'-'\n '---''(_/--' `-'\_) ''',
'bye9': '''\n . . \n \`-"'"-'/\n } 6 6 { \n =. Y ,= \n (""-'***`-"") \n `-/ \-' \n ( )-( )===' \n "" ""''',
'bye10': '''\n .--.\n `. \.\n \ \.\n . \.\n : .\n | .\n | :\n | |\n ..._ ___ | |\n `."".`````'""--..___ | |\n ,-\ \ ""-...__ _____________/ |\n / ` " ' `"""""""" .\n \ L\n (> \.\n/ \.\n\_ ___..---. L\n `--' '. \.\n . \_\n _/`. `.._\n .' -. `.\n / __.-Y /''''''-...___,...--------.._ |\n / _." | / ' . \ '---..._ |\n / / / / _,. ' ,/ | |\n \_,' _.' / /'' _,-' _| |\n ' / `-----'' / |\n `...-' `...-''',
'bye11': '''\n __,,,,_\n _ __..-;''`--/'/ /.',-`-.\n (`/' ` | \ \ \\ / / / / .-'/`,_\n /'`\ \ | \ | \| // // / -.,/_,'-,\n /<7' ; \ \ | ; ||/ /| | \/ |`-/,/-.,_,/')\n/ _.-, `,-\,__| _-| / \ \/|_/ | '-/.;.\'\n`-` f/ ; / __/ \__ `/ |__/ |\n `-' | -| =|\_ \ |-' |\n __/ /_..-' ` ),' //\n fL ((__.-'((___..-'' \__.''',
'bye12': '''\n _\n( \.\n \ \.\n / / |\\.\n/ / .-`````-. / ^`-.\n\ \ / \_/ {|} `o\n \ \ / .---. \\ _ ,--'\n \ \/ / \, \( `^^^\n \ \/\ (\ )\n \ ) \ ) \ \.\n ) /__ \__ ) (\ \___\n (___)))__))(__))(__)))''',
'bye13': '''\n .'\ /`.\n .'.-.`-'.-.`.\n ..._: .-. .-. :_...\n .' '-.(o ) (o ).-' `.\n : _ _ _`~(_)~`_ _ _ :\n: /: ' .-=_ _=-. ` ;\ :\n: :|-.._ ' ` _..-|: :\n : `:| |`:-:-.-:-:'| |:' :\n `. `.| | | | | | |.' .'\n `. `-:_| | |_:-' .'\n `-._ ```` _.-'\n ``-------''''',
'bye14': '''\n _\n | \.\n | |\n | |\n |\ | |\n /, ~\ / /\nX `-.....-------./ /\n ~-. ~ ~ |\n \ / |\n \ /_ ___\ /\n | /\ ~~~~~ \ |\n | | \ || |\n | |\ \ || )\n (_/ (_/ ((_/''',
'bye15': '''\n ,w.\n ,YWMMw ,M ,\n _.---.._ __..---._.'MMMMMw,wMWmW,\n _.-"" """ YP"WMMMMMMMMMb,\n .-' __.' .' MMMMW^WMMMM;\n _, .'.-'"; `, /` .--"" :MMM[==MWMW^;\n ,mM^" ,-'.' / ; ; / , MMMMb_wMW" @\.\n,MM:. .'.-' .' ; `\ ; `, MMMMMMMW `"=./`-,\nWMMm__,-'.' / _.\ F"""-+,, ;_,_.dMMMMMMMM[,_ / `=_}\n"^MP__.-' ,-' _.--"" `-, ; \ ; ;MMMMMMMMMMW^``; __|\n / .' ; ; ) )`{ \ `"^W^`, \ :\n / .' / ( .' / Ww._ `. `"\n / Y, `, `-,=,_{ ; MMMP`""-, `-._.-,\n (--, ) `,_ / `) \/"") ^" `-, -;"\:\n `""" `""" `"' `---"''',
'bye16': '''\n ._ __ ____\n; `\--,-' /`) _.-' `-._\n \_/ ' | /`--,' `-. .--....____\n / `._.' `---...\n |-. _ ; .-----..._______)\n,,\q/ (q_>'_... .-'\n===/ ; _.-'~~- / ,'\n`""`-'_,; `"" ___( |\n \ ; /'/ \ \.\n `. //' ( ;`\ `\.\n / \ ; `- / `-. /\n ( (; ; (__/ / /\n \,_)\ ; ,' /\n .-. | | `--'\n ("_.)-._ (__,> ''',
'bye17': '''\n- - - - - -- - - - - - _ - - - - - - - - -\n=- - =- = - = - =- = _.----~~~~~~-----..__ = =- -=- - = = -=-- = -\n=#-= =-# - == ##= -__..------~~~~- .._ ~~-. #== -#- = =- ##=-= =#- -\n#===#==___.--.--~~~~ --~~~~---~ __ ~~----.__ ~~~~~~~---...._____#== =##=\n##(~~~~_..----~ ~~--=< O >- .----. -< O >=--~~ .. .)#=#=##=\n###~-..__..-- .. ___-----_...__-----___ _. ~-=___..-~#########\n##==#===#==` _ .. ( " :_.}{._; " " ) _- '==#=##=====#=#==\n=#-==-== =# \ ~~- ` " " __###__ "" ' -~ .'==-=#===#- -=- #=\n-= == -= -= `-._ ~-. _`--~~~VvvvvVV~~---'_ ~.. _. #= = = ==# - ==\n = -== - = - == -. `~##\( )/###~' . _.~ -=- = -= -=- -\n= - -= - - - - `.###\# { #/####.' _-~ - = - - - - = -\n - - - - -_ -#### ! #####- .. - - - - - -\n -._ ~.### } ###-~ ___.-~\n ~- \## / " ##.~ /~ \n \ |### " ###' / \n \`/\#######/\' ; \n ~-.^^^^^^^ .-~ \n ~~~~~~~~''',
'bye17': '''\n ,\/~~~\_ _/~~~~\.\n | ---, `\_ ___,-------~~\__ /~' ,,'' |\n | `~`, ',,\`-~~--_____ --- - /, ,--/ '/'\n `\_|\ _\` ______,---~~~\ ,_ '\_/' /'\n \,_| , '~,/'~ /~\ ,_ `\_\ \_ \_\'\n ,/ /' ,/' _,-'~~ `\ ~~\_ ,_ `\ `\.\n /@@ _/ /' ./',- \ `@,\n @@ ' | ___/ /' / \ \ '\__ _`~|, `, @@\n/@@ / | | ',___ | | ` | ,,---, | | `@@,\n@@@ \ | | \ \O_`\ | / / O_/' | \ \ @@@\n@@@ | | `| ' ~ / , ~ / | @@@\n`@@ | \ `\ ` | | | _/' /' | @@'\n @@ | ~\ /--'~ | , | \__ | | |@@\n @@, \ | ,,| | ,,| | `\ /',@@\n `@@, ~\ \ ' | / / `' ' / ,@@\n @@@, \ ~~\ `\/~---'~/' _ /'~~~~~~~~--,_\n `@@@_,---::::::= `-,| ,~ _=:::::`````` `\n ,/~~_---'_,-___ _-__ ' -~~~\_```---\n ~` ~~_/'// _,--~\_/ '~--, |\_\n /' /'| `@@@@@,,,,,@@@@ | \ -Chev\n ` `@@@@@@''',
'bye17': '''\n .... .... \n ..x.... ....x.. \n ..xx...... ........ ......xx.. \n ..xxxx...,,. .............. .,,...xxxx.. \n ..xxxxx,,,,..................,,,,xxxxx.. \n .,,,,..,,...................,,..,,,,,. \n ........ ,,,.................,,, ......... \n ....... .(((,,,...............,,,))). ........ \n ..... ..,,a@@@@a,,...........,,a@@@@a,,.. ...... \n .......,,a@@` '@@,...........,@@` '@@a,,........ \n .......,,@@@ @@@,.a@@@@@a.,@@@ @@@,,........ \n ....,,,,,,@@@aa@@@,,,,`@@@',,,,@@@aa@@@,,,,,,,.... \n ...,,,,,,,,,,,,,,,,,,,,|,,,,,,,,,,,,,,,,,,,,,... \n ...,,,,,,,,,,,,,,,,` ',,,,,,,,,,,,,,,,,... \n .. ,,,,,,,,,,,,,...,,,,,,,,,,,,,, .. \n ( ......... ,,,,,,,,,,,,,,,,,,, ........... \n ( ) .............._ _ _ _ _ _ _ _................ ( \n ) ( ............................................... ) \n ( ) ............................................... ( ) \n ) ( ,,,,,,,,,,,,,,, ................. ,,,,,,,,,,,,,,,, ) ( \n ,%%%%,,,,,,,,,,,,,,,,,, ............... ,,,,,,,,,,,,,,,,,,%%%%, \n %%%%%`.,,(,,(,,(,,(,,'%%%%%%%%%%%%%%%%%%`,,,),,),,),,),,.'%%%%% \n `%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%' \n %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \n ::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::: \n ::::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::: \n ::::::;;%%;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::: \n ::::::;;%%;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%%:::::: \n::::::;;%%%;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%%:::::: \n::::::;;%%%;;;;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;%%%::::: \n::::::;;;%%;;;;;AA;;;;;;;;;;;;;;;;;;;;A;;;;;;;;;;;;;;;;;;%%%::::: \n::::::;;;;%%;;;;;AAA;;;;;;;;;;;;;;;;AA;;;;;;;;;;;;A;;;;;;%%:::::: \n::::::;;A;;;;;;;;;AAA;;;;;;;;;A;;;;AAA;;;;;;;;;;;;;AA;;;%%;:::::: \n ::::::;AA;;;;;;;;;AAA;;;;;;;A;;;;;AAAA;;;;;A;;;;;;AAA;;;;:::::: \n ::::::;AAA;;;;;;;AAA;;A;;;AA;;;;;;AAAA;;;;AA;;;;;AAA;;;:::::: \n :::::;AAA;;;;;AAA;;AA;;;AAA;;;;;;AAAA;;AAA;;;;AAAA;;::::: \n :::;AAAA;;AAAA;;AAA;;;AAA;;;;AAAAA;AAA;;;;AAAAAA::: \n ::AAAAAAAA;;;;AAA;AAAAA;;AAAAA;;;AAA;;AAAAAAA \n .:::::: ::::::. \n :::::::' `:::::::''',
'bye17': '''\n _,.\n ,'' `. __....__ \n ,' >.-'' ``-.__,)\n ,' _,'' _____ _,'\n / ,' _.:':::_`:-._ \n : ,' _..-'' \`'.;.`-:::`:. \n ; / ,' ,::' .\,'`.`. `\::)` \n / / ,' \ `. ' ) )/ \n / / /:`. `--`' \ '`\n `-._/ /::::) )\n / /,-.:( , _ `.-' \n ; :(,`.`-' ',`. ;\n : |:\`' ) `-.._\ _\n | `:-( `)``-._ \n | `.`. /``' ``:-.-__,\n : / `:\ . : ` \`-\n \ ,' '} `. |\n _..-`. ,'`-. } |`-' \n,'__ `-'' -.`.'._| | \n ```--..,.__.(_|.| |::._\n __..','/ ,' : `-.|::)_`.\n `..__..-' |`. __,' \n : `-._ ` ;\n \ \ ) /\n .\ `. /\n :: /\n :| ,'\n :;,' SSt\n `''',
}
# Colortable for the rainbow function
colors = ['\033[31m', "\033[32m", "\033[33m", "\033[34m", "\033[35m", "\033[36m", "\033[91m", "\033[92m",
"\033[93m", "\033[94m", "\033[95m", "\033[96m", '\033[35m', "\033[95m", "\033[97m", "\033[90m", "\033[38;5;208m"]
red, green, yellow, blue, magenta, cyan, lred, lgreen, lyellow, lblue, lmagenta, lcyan, magenta, lmagenta, white, gray, orange = colors
# ColorVariations
blizzard = [lblue, lcyan, white]
acid = [lcyan, lgreen, lyellow]
hacker = [green, lgreen, gray]
love = [red, lred, magenta, lmagenta, white]
death = [red, lred, gray, lgreen]
circus = ['\033[31m', "\033[91m", "\033[93m", "\033[94m"]
gay = [lmagenta, white, lblue]
jamaika = [red, green, yellow]
ocean = [blue, cyan, white]
forest = [green, lgreen, red]
space = [gray, lyellow, white]
romance = [lred, magenta, lmagenta, green, gray, lyellow]
night = [gray, white]
desert = [yellow, lyellow, green]
rainbow = [red, lred, green, lgreen, blue, lblue, magenta]
sunset = [red, lred, orange, yellow, lyellow]
sunrise = [orange, yellow, lyellow, lgreen, blue]
neon = [lgreen, lblue, lmagenta, lyellow]
modes = [1, 2, 3, 4, 5, 'blizzard', 'acid', 'hacker', 'love', 'death', 'raw', 'gay', 'circus',
'jamaika', 'ocean', 'forest', 'space', 'romance', 'night', 'desert', 'rainbow', 'sunset', 'neon']
bye_ascii = ['bye0', 'bye1', 'bye2', 'bye3',
'bye4', 'bye5', 'bye6', 'bye7', 'bye8', 'bye9', 'bye10', 'bye11', 'bye12', 'bye13', 'bye14', 'bye15', 'bye16', 'bye17']
# ==================================================================================================
# ==================================================================================================
# =======================================FUNCTIONS==================================================
# ==================================================================================================
# ==================================================================================================
def format_size(size): # Filesize formater
# 2**10 = 1024
power = 2**10
n = 0
power_labels = {0: '', 1: 'K', 2: 'M', 3: 'G', 4: 'T'}
while size > power:
size /= power
n += 1
if n == 0 and size > 0:
return f"{round(size,2)}B"
elif n == 0 and size == 0:
return 'FOLDER'
else:
return f"{round(size,2)}{power_labels[n]}B"
def signal_handler(log): # For clean exit
if log:
rand = random.randint(0, len(bye_ascii) - 1)
print_ascii(bye_ascii[rand], "r")
sys.exit(0)
def rainbow_ascii(ascii_text, mode): # Make colorfull text
if mode == "r":
mode = modes[int(random.random() * len(modes))]
ascii_lines = ascii_text.split('\n')
formatted_lines = []
for line in ascii_lines:
formatted_chars = []
for char in line:
if mode == 1:
formatted_chars.append(colors[int(
random.random() * len(colors) / 4)] + char + "\033[0m")
elif mode == 2:
formatted_chars.append(colors[int(
random.random() * len(colors) / 3)] + char + "\033[0m")
elif mode == 3:
formatted_chars.append(colors[int(
random.random() * len(colors) / 2.5)] + char + "\033[0m")
elif mode == 4:
formatted_chars.append(colors[int(
random.random() * len(colors) / 1.5)] + char + "\033[0m")
elif mode == 5:
formatted_chars.append(colors[int(
random.random() * len(colors))] + char + "\033[0m")
elif mode == 'blizzard':
formatted_chars.append(blizzard[int(
random.random() * len(blizzard))] + char + "\033[0m")
elif mode == 'acid':
formatted_chars.append(acid[int(
random.random() * len(acid))] + char + "\033[0m")
elif mode == 'hacker':
formatted_chars.append(hacker[int(
random.random() * len(hacker))] + char + "\033[0m")
elif mode == 'love':
formatted_chars.append(love[int(
random.random() * len(love))] + char + "\033[0m")
elif mode == 'death':
formatted_chars.append(death[int(
random.random() * len(death))] + char + "\033[0m")
elif mode == 'jamaika':
formatted_chars.append(jamaika[int(
random.random() * len(jamaika))] + char + "\033[0m")
elif mode == 'gay':
formatted_chars.append(gay[int(
random.random() * len(gay))] + char + "\033[0m")
elif mode == 'circus':
formatted_chars.append(circus[int(
random.random() * len(circus))] + char + "\033[0m")
elif mode == 'ocean':
formatted_chars.append(ocean[int(
random.random() * len(ocean))] + char + "\033[0m")
elif mode == 'forest':
formatted_chars.append(forest[int(
random.random() * len(forest))] + char + "\033[0m")
elif mode == 'space':
formatted_chars.append(space[int(
random.random() * len(space))] + char + "\033[0m")
elif mode == 'romance':
formatted_chars.append(romance[int(
random.random() * len(romance))] + char + "\033[0m")
elif mode == 'night':
formatted_chars.append(night[int(
random.random() * len(night))] + char + "\033[0m")
elif mode == 'desert':
formatted_chars.append(desert[int(
random.random() * len(desert))] + char + "\033[0m")
elif mode == 'rainbow':
formatted_chars.append(rainbow[int(
random.random() * len(rainbow))] + char + "\033[0m")
elif mode == 'sunset':
formatted_chars.append(sunset[int(
random.random() * len(sunset))] + char + "\033[0m")
elif mode == 'sunrise':
formatted_chars.append(sunrise[int(
random.random() * len(sunrise))] + char + "\033[0m")
elif mode == 'neon':
formatted_chars.append(neon[int(
random.random() * len(neon))] + char + "\033[0m")
elif mode == 'raw':
color1 = random.choice(colors)
color2 = random.choice(colors)
count = 0
for char in line:
if char.isalpha():
if color1 == color2:
color2 = random.choice(colors)
formatted_chars.append(color1 + char)
color1, color2 = color2, color1
else:
if count == 0:
formatted_chars.append(color1 + char + "\033[0m")
count += 1
elif count == 1:
formatted_chars.append(color2 + char + "\033[0m")
count -= 1
break
formatted_lines.append(''.join(formatted_chars))
if show_mode:
formatted_lines.append(" Mode: " + str(mode))
return '\n'.join(formatted_lines)
def print_ascii(ascii_name, mod): # print colorfull ascii
print(rainbow_ascii(asciis[ascii_name], mod))
def ascii_color_show(): # Make a colorfull show of all modes
the_show = '''
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@'''
print(rainbow_ascii("Welcome to the Color Show", "r"))
print(rainbow_ascii('╔═══════════════════════════════════════════════╗', "hacker"))
for modez in modes:
print(rainbow_ascii(the_show, modez))
print(rainbow_ascii('╚═══════════════════════════════════════════════╝', "hacker"))
print(rainbow_ascii("The END", "r"))
input("Press Enter to continue...")
def fast_travel(): # Fast Travel to custom Paths [Done code/ No color]
os.system('clear')
print_ascii('fasttravel', title_mode)
list_current()
list_custom()
while True:
choice = input('Destination (0 or q to quit): ')
if choice == '0' or choice.lower() == 'q':
break
elif choice.isdigit() == False:
print('Invalid Input!')
continue
elif choice == str(len(paths) + 1):
path = input('Your wished Destination: (0 or q to quit)')
if path.lower() == 'q' or path == '0':
print('Aborted.')
break
os.chdir(path)
break
elif int(choice) >= 1 and int(choice) <= len(paths):
os.chdir(paths[int(choice) - 1])
break
else:
print('Invalid Destination')
def list_files(): # List all Files in current Directory [Done code/ No color]
files = os.listdir()
print('\nFiles in working directory:')
print(os.getcwd())
print('╔═══════════════════════════════════════════════╗')
max_length = 0
for i, file in enumerate(files):
if os.path.isfile(file):
if len(file) > max_length:
max_length = len(file)
for i, file in enumerate(files):
if os.path.isfile(file):
size = os.path.getsize(file)
size = format_size(size)
permissions = os.stat(file).st_mode
if len(file) > 40:
print("║ " + str(i+1).rjust(2) + ". " + file + " [ " + size.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" [ " + size.rjust(7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
file_count = len(os.listdir(file))
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" ( FOLDER ) [ x" + str(file_count).rjust(3) + " Files ]")
print('╚═══════════════════════════════════════════════╝')
def find_file(): # Find a filename in specified Path [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('find', title_mode)
list_current()
paths = ["/", "/home/pi", "/etc", "/boot", "/mnt/usb1/ELEMENTS"]
while True:
filename = input('\nEnter a filename (0 or q to quit): ')
if filename.lower() == 'q' or filename == '0':
print('Aborted.')
break
print(
'\n╔═════════════════════════════════════════════════════════════════════════╗')
for i in range(len(paths)):
print("║ " + str(i+1).rjust(2) + ": " + paths[i])
print("║ " + str(len(paths)+1) + ": Enter a custom path")
print('╚═════════════════════════════════════════════════════════════════════════╝')
path_choice = input("\nChoose a path to search (0 or q to quit): ")
if path_choice == "0" or path_choice == "q":
break
elif int(path_choice) > len(paths):
custom_path = input("Enter a custom path: ")
print('\nSearching for Files...\n╔═════════════════════════════════════════════════════════════════════════╗')
os.system('find ' + custom_path + ' -name ' + filename)
print(
'╚═════════════════════════════════════════════════════════════════════════╝')
break
else:
print('\nSearching for Files...\n╔═════════════════════════════════════════════════════════════════════════╗')
os.system(
'find ' + paths[int(path_choice)-1] + ' -name ' + filename)
print(
'╚═════════════════════════════════════════════════════════════════════════╝')
break
input('Press enter to continue...')
def create(): # Create a new File or Folder [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('txt', title_mode)
list_current()
list_files()
filename = ''
while True:
choice = input(
'Do you want to create a folDer or a File? (f/d) (0 or q to quit): ')
if choice == 'f':
filename = input(
'Enter an existing or new filename (0 or q to quit): ')
if filename.lower() == 'q' or filename == '0':
print('Aborted.')
break
if os.path.exists(filename):
overwrite = input(
'File already exists. Do you want to overwrite? (y/n) ')
if overwrite == 'y':
os.system('nano ' + filename)
break
elif overwrite == 'n':
pass
else:
os.system('nano ' + filename)
break
elif choice == 'd':
foldername = input(
'Enter a foldername (0 or q to quit): ')
if foldername.lower() == 'q' or foldername == '0':
print('Aborted.')
break
if os.path.exists(foldername):
overwrite = input(
'Folder already exists. Do you want to overwrite and rename it? (y/n) ')
if overwrite == 'y':
os.system('rm -r ' + foldername)
os.system('mkdir ' + foldername)
break
elif overwrite == 'n':
pass
else:
os.system('mkdir ' + foldername)
break
elif choice.lower() == 'q' or choice == '0':
print('Aborted.')
break
input('Press enter to continue...')
def read_file_out(): # Read a File out [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('read', title_mode)
list_current()
list_files()
while True:
filename = input(
'Enter an existing or new filename (0 or q to quit): ')
if filename.lower() == 'q' or filename == '0':
print('Aborted.')
break
elif filename.isdigit() == False:
print('Invalid Input!')
continue
else:
file_name = os.listdir(os.getcwd())[int(filename)]
file_size = os.path.getsize(file_name)
file_size_formatted = format_size(file_size)
print(
f'\n╔═════════════════════════════════════════════════════════════════════════╗\n Name: {file_name}\n Size: {file_size_formatted}\n╠════════════════════════════════════════╣')
text = os.system('cat ' + file_name)
print(str(text).replace('$', ''))
input('\n╚═════════════════════════════════════════════════════════════════════════╝\nPress enter to continue...')
break
def rename_file(): # Rename a File or Folder [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('rename', title_mode)
list_current()
files = os.listdir()
print('Files in working directory: ')
print('\n╔═════════════════════════════════════════════════════════════════════════╗')
for i, file in enumerate(files):
size = os.path.getsize(file)
size_formatted = format_size(size)
permissions = os.stat(file).st_mode
if os.path.isdir(file):
file_count = len(os.listdir(file))
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" ( FOLDER ) [ x" + str(file_count).rjust(3) + " Files ]")
else:
if len(file) > 40:
print("║ " + str(i+1).rjust(2) + ". " + file + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
print('╚═════════════════════════════════════════════════════════════════════════╝')
while True:
try:
file_index = input('Enter a file number (0 or q to quit): ')
if file_index == 0 or file_index.lower() == 'q':
break
elif file_index.isdigit() == False:
print('Invalid Input!')
continue
else:
print("═══════════════════════════════════════")
filename = files[int(file_index) - 1]
new_filename = input('Enter a NEW filename (0 or q to quit): ')
if new_filename.lower() == 'q' or new_filename == '0':
print('Aborted.')
break
os.rename(filename, new_filename)
except FileNotFoundError:
print('The specified file was not found.')
input('Press enter to continue...')
break
except IndexError:
print('The specified file number was not found.')
input('Press enter to continue...')
break
else:
print(
f'File renamed successfully, from: \n {filename}\nto: {new_filename}.')
input('Press enter to continue...')
break
def move_file(): # Move a File or Folder [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('move', title_mode)
list_current()
folder_files = os.listdir()
print('Files in working directory:')
print('\n╔═════════════════════════════════════════════════════════════════════════╗')
file_list = []
for i, file in enumerate(folder_files):
size = os.path.getsize(file)
size_formatted = format_size(size)
permissions = os.stat(file).st_mode
file_list.append(file)
if os.path.isdir(file):
file_count = len(os.listdir(file))
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" ( FOLDER ) [ x" + str(file_count).rjust(3) + " Files ]")
else:
if len(file) > 41:
print("║ " + str(i+1).rjust(2) + ". " + file + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
print('╚═════════════════════════════════════════════════════════════════════════╝')
while True:
filename = input(
'Enter the fileindex to move (separated by commas, 0 or q to quit): ')
if filename.lower() == 'q' or filename == '0':
print('Aborted.')
break
filenames = filename.split(',')
for i in range(len(filenames)):
if filenames[i].isdigit() == False:
print('\nInvalid Input!')
filenames.remove(filenames[i])
else:
filenames[i] = int(filenames[i]) - 1
for filename in filenames:
if int(filename) > len(folder_files):
print('\nInvalid Input! File not found.', int(filename)+1)
filenames.remove(filenames[filenames.index(filename)])
break
list_custom()
while True:
choice = input('Option: ')
if choice == '0' or choice.lower() == 'q':
print('Aborted.')
break
elif choice.isdigit() == False:
print('Invalid Input!')
continue
elif choice == str(len(paths) + 1):
path = input('Own Path: ')
if not os.path.exists(path):
mv_create = input(
'Path does not exist. Would you like to create it? (Y/N)')
if mv_create == 'Y' or mv_create == 'y':
os.makedirs(path)
for filename in filenames:
os.system('mv ' +
folder_files[int(filename)] + ' ' + path)
print('Files moved successfully to ' + path)
else:
print("Aboarding, no folder created.")
continue
else:
for filename in filenames:
print(folder_files[int(filename)])
os.system('mv ' +
folder_files[int(filename)] + ' ' + path)
print('Files moved successfully to ' + path)
break
elif int(choice)-1 >= 0 and int(choice)-1 <= len(paths):
for filename in filenames:
print(folder_files[int(filename)])
os.system(
'mv ' + folder_files[int(filename)] + ' ' + paths[int(choice) - 1])
print('Files moved successfully to ' + paths[int(choice) - 1])
break
else:
print('Invalid Option.')
continue
input('Press enter to continue...')
break
def copy_file(): # Copy a File or Folder [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('copy', title_mode)
list_current()
folder_files = []
for file in os.listdir():
folder_files.append(file)
print('Files in working directory:')
print('\n╔═════════════════════════════════════════════════════════════════════════╗')
for i, file in enumerate(folder_files):
size = os.path.getsize(file)
size_formatted = format_size(size)
permissions = os.stat(file).st_mode
if os.path.isdir(file):
file_count = len(os.listdir(file))
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" ( FOLDER ) [ x" + str(file_count).rjust(3) + " Files ]")
else:
if len(file) > 40:
print("║ " + str(i+1).rjust(2) + ". " + file + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
print('╚═════════════════════════════════════════════════════════════════════════╝')
while True:
filename = input(
'Enter a fileindex to copy (seperate with comma 1,2,3) (0 or q to quit): ')
filenames = filename.split(',')
if filename.lower() == 'q' or filename == '0':
print('Aborted.')
break
for i in range(len(filenames)):
if filenames[i].isdigit() == False:
print('Invalid Input! ' + filenames[i])
filenames.remove(filenames[i])
continue
else:
filenames[i] = int(filenames[i]) - 1
else:
list_custom()
while True:
choice = input('Option: ')
if choice == '0' or choice.lower() == 'q':
print('Aborted.')
break
elif choice.isdigit() == False:
print('Invalid Input!')
continue
elif choice == str(len(paths) + 1):
path = input('Own Path: ')
if not os.path.exists(path):
mv_create = input(
'Path does not exist. Would you like to create it? (Y/N)')
if mv_create == 'Y' or mv_create == 'y':
os.makedirs(path)
for filename in filenames:
print(folder_files[filename])
is_directory = os.path.isdir(
folder_files[filename])
folderdd = "-r " if is_directory else ""
os.system('cp ' + folderdd +
folder_files[filename] + ' ' + path)
print('File copied successfully to: ' +
path)
break
else:
print("Aboarding, no folder created.")
continue
else:
for filename in filenames:
is_directory = os.path.isdir(
folder_files[filename])
folderdd = "-r " if is_directory else ""
print(folder_files[filename])
os.system('cp ' + folderdd +
folder_files[filename] + ' ' + path)
print('File copied successfully to: ' +
path)
break
elif int(choice) >= 1 and int(choice) <= len(paths):
for filename in filenames:
print(folder_files[filename])
is_directory = os.path.isdir(folder_files[filename])
folderdd = "-r " if is_directory else ""
os.system('cp ' + folderdd +
folder_files[filename] + ' ' + paths[int(choice) - 1])
print('File copied successfully to: ' +
paths[int(choice) - 1])
break
input('Press enter to continue...')
break
def delete_file(): # Delete a File or Folder [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('delete', title_mode)
list_current()
list_files = []
files = os.listdir()
for file in files:
list_files.append(file)
print('Files in working directory:')
print('\n╔═════════════════════════════════════════════════════════════════════════╗')
for i, file in enumerate(list_files):
size = os.path.getsize(file)
size_formatted = format_size(size)
permissions = os.stat(file).st_mode
if os.path.isdir(file):
file_count = len(os.listdir(file))
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) +
" ( FOLDER ) [ x" + str(file_count).rjust(3) + " Files ]")
else:
if len(file) > 40:
print("║ " + str(i+1).rjust(2) + ". " + file + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
else:
print("║ " + str(i+1).rjust(2) + ". " + file.ljust(41) + " [ " + size_formatted.rjust(
7) + " ] [ " + str(oct(permissions)[-3:]).rjust(3) + " ]")
print('╚═════════════════════════════════════════════════════════════════════════╝')
file_numbers = []
file_number = input(
'Enter files number (separated by comma) (0 or q to quit): ')
file_split = file_number.split(',')
while True:
if file_number.lower() == 'q' or file_number == '0':
print('Aborted.')
return
for split_file in file_split:
try:
file_numbers.append(int(split_file) - 1)
except ValueError:
print('Invalid file number. Aboard,')
input('Press enter to continue...')
return
break
print(" ")
for del_index in file_split:
del_inx = int(del_index)-1
if not os.path.isfile(list_files[del_inx]) and not os.path.isdir(list_files[del_inx]):
print('Error: This file does not exist.')
continue
if os.path.isdir(list_files[del_inx]):
folderdd = "-r "
else:
folderdd = ""
os.system('rm ' + folderdd + list_files[del_inx])
print('File deleted successfully file: ' +
list_files[del_inx])
input('\n Done deleting\n\nPress enter to continue...')
def zip_file(): # Create a ZIP File [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('zip', title_mode)
list_current()
files_in_directory = []
for file in os.listdir():
files_in_directory.append(file)
if not files_in_directory:
print('No files in working directory.')
input('Press enter to continue...')
return
while True:
zip_filename = input(
'\n\nEnter a ZIP-fileNAME (without .zip) (0 or q to quit): ') + '.zip'
if zip_filename.lower() == 'q' or zip_filename == '0':
print('Aborted.')
break
list_files()
file_indexes = input(
'Enter the indexes of the files to add to ZIP-file (separated1,2,3) (0 or q to quit): ')
if file_indexes.lower() == 'q' or file_indexes == '0':
print('Aborted.')
break
print(" ")
start_time = time.time()
files_to_zip = []
with zipfile.ZipFile(zip_filename, 'a') as zf:
for index in file_indexes.split(','):
index = int(index) - 1
if index < len(files_in_directory):
filename = files_in_directory[index]
if os.path.exists(filename):
zf.write(filename)
print('File', filename, 'zipped to', zip_filename)
files_to_zip.append(filename)
else:
print('File', filename, 'does not exist. Skipping.')
else:
print('Index', index, 'out of range. Skipping.')
print(" ")
end_time = time.time()
total_time = end_time - start_time
print(
'\n╔═════════════════════════════════════════════════════════════════════════╗')
print('║ Zip Information')
print(
f"║ Start Time: {time.strftime('%H:%M:%S', time.localtime(start_time))}")
print(
f"║ End Time: {time.strftime('%H:%M:%S', time.localtime(end_time))}")
print(f"║ Total Time: {total_time:.2f} seconds")
print('║ Files:')
for source in files_to_zip:
file_name = source
file_size = os.path.getsize(source)
file_size_form = format_size(file_size)
print(f"║ {file_name.ljust(64)} [ {file_size_form.rjust(7)} ]")
print('║\n║ Destination:')
zip_size = os.path.getsize(zip_filename)
zip_size_form = format_size(zip_size)
print("║ " + (os.getcwd() + "/" + zip_filename).ljust(64) +
f" [ {zip_size_form.rjust(7)} ]")
print('╚═════════════════════════════════════════════════════════════════════════╝')
break
input('Press enter to continue...')
def unzip_file(): # Unzip a ZIP File [Done code/ No color]
os.system('clear')
print_ascii('logo', logo_mode)
print_ascii('unzip', title_mode)
list_current()
list_files()
zip_files = os.listdir()
if not zip_files:
print('No files found in working directory.')
input('Press enter to continue...')
else:
while True:
zip_fileindex = input(
'Enter a fileIndex ( seperate with comma 1,2,3) (0 or "q" to quit): ')
zip_filename = zip_files[int(
zip_fileindex)-1] if zip_fileindex != 'q' and zip_fileindex != '0' else None
if zip_filename is None:
print('Aborted.')
input('Press enter to continue...')
continue
if '.zip' not in zip_filename:
print('Error: Not a ZIP-file.')
continue
elif zip_filename in zip_files:
start_time = time.time()
with zipfile.ZipFile(zip_filename, 'r') as zf:
extracted_files = zf.namelist()
zf.extractall()
print(extracted_files)
end_time = time.time()
total_time = end_time - start_time
print(
'\n╔═════════════════════════════════════════════════════════════════════════╗')
print('║ Unzip Information')
print(
f"║ Start Time: {time.strftime('%H:%M:%S', time.localtime(start_time))}")
print(
f"║ End Time: {time.strftime('%H:%M:%S', time.localtime(end_time))}")
print(f"║ Total Time: {total_time:.2f} seconds")
print('║ Files:')
for source in extracted_files:
file_name = source
file_size = os.path.getsize(source)
file_size_form = format_size(file_size)
print(
f"║ {file_name.ljust(64)} [ {file_size_form.rjust(7)} ]")
print('║\n║ Destinations:')
print(f"║ {os.getcwd()}")
print(
'╚═════════════════════════════════════════════════════════════════════════╝')
else:
print(f'{zip_filename} not found in working directory.')
input('Press enter to continue...')
break
def change_dir(): # Change Directory to present Folder [Done code/ No color]