Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions file_placer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@
getfileList = ' '
newfileExt = []
newSet = set()
fullPath = os.path.join(chgeDirectory, getfileList)
getFilename = []
myAppend = []

fullPath = ''

if currentDirectory != chgeDirectory:
os.chdir(chgeDirectory)
Expand All @@ -41,16 +38,14 @@
else:
fileSide.append(check)


if newFolder not in folderSide:
os.mkdir(newFolder)

print(f"{newFolder} folder created successful")
else:
print(f"{newFolder} folder already exits")


# Differentiate the file from the extension
# Differentiate the file from the extension

for f in fileSide:

Expand All @@ -60,23 +55,18 @@
fileName = splitFileExt[0]
fileExt = splitFileExt[1]

# Using regular Expression to separate the file extension from the file name
# Using regular Expression to separate the file extension from the file name

for ext in fileExt:
regExt = re.search(r'\.(\w+)', fileExt)
newfileExt.append(regExt.group(1))

# Making the extension to be unique in the file
# Making the extension to be unique in the file

for uni in newfileExt:
newSet.add(uni.lower())

print(newSet)

print("Here is the second set side")
print(len(newSet))

# Creating the Folder from the file extension
# Creating the Folder from the file extension

for uniqFile in newSet:
try:
Expand All @@ -92,7 +82,6 @@
for vryFile in lstDir:

if os.path.isfile(vryFile):

fullPath = os.path.join(chgeDirectory, vryFile)

for chkFolder in folderSide:
Expand All @@ -114,4 +103,4 @@

urlLink3 = "https://www.youtube.com/watch?v=isRtFdu8sRs"
#
#
#