Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 11 additions & 0 deletions delscript.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import glob
import os

directory=os.getcwd() # 'C:\Users\mahabarat'
os.chdir(directory)
files=glob.glob('*')
for filename in files:
if os.stat(filename).st_size<100:
os.unlink(filename)

#deletes the files which are having lesser than 100KB size in current folder
16 changes: 16 additions & 0 deletions renaming1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import os
os.chdir('folder_path') # please add the path to your folder inside quotes
i=['0','1','2','3','4']
k=0
for f in os.listdir():
name,ext=os.path.splitext(f)
newname='{}{}'.format(i[k],ext)
os.rename(f,newname)
print(f)
k=k+1

for f in os.listdir():
print(f)


#this program renames all the files in a particular folder in order of created date time