-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_empty_files.py
More file actions
46 lines (37 loc) · 1.14 KB
/
Copy pathmake_empty_files.py
File metadata and controls
46 lines (37 loc) · 1.14 KB
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
# Makes empty files by given options to script file's location
# 24.04.2022 Arttu Rautio
# https://aturtur/
# Libraries
import os
import platform as pf
# Functions
def GetSep():
if pf.system() == "Windows": # If os is windwos
return "\\" # Return \
else: # Is os is something else (mac or linux)
return "/" # Return /
def CreateEmptyFiles(fileName, fileRange, zeros, extension):
path = os.path.dirname(os.path.realpath(__file__))
zeros = int(zeros)
parse = fileRange.split("-")
rStart = int(parse[0])
rEnd = int(parse[1]) + 1
sep = GetSep()
for i in range(rStart, rEnd):
newFilePath = path+sep+fileName+"%s.%s" %(str(i).zfill(zeros), extension)
makeFile = open(newFilePath, "w")
print("Created a new file: " + newFilePath)
makeFile.close()
# Run the program
print ("File name")
fileName = input("> ")
print ("File extension")
extension = input("> ")
print ("File range from-to (example: 5-25)")
fileRange = input("> ")
print ("Zeros (4 = 0001)")
zeros = input("> ")
CreateEmptyFiles(fileName, fileRange, zeros, extension)
print (" ")
print ("Done!")
print (">Exit")