File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55* .o
66
77* .exe
8+
9+ stacktestbench
10+ cputestbench
11+ alutestbench
Original file line number Diff line number Diff line change 1- # remove *.txt, *.cf, *.vcd in the current directory and all subdirectories of "test"
2-
31import os
42import glob
53
6- # remove all .txt, .cf, and .vcd files in the current directory
7- for file in glob .glob ("*.txt" ):
8- os .remove (file )
9- for file in glob .glob ("*.cf" ):
10- os .remove (file )
11- for file in glob .glob ("*.vcd" ):
4+ # File extensions to remove
5+ extensions = (".txt" , ".cf" , ".vcd" , ".o" )
6+
7+ # Remove files in the current directory
8+ for ext in extensions :
9+ for file in glob .glob (f"*{ ext } " ):
10+ os .remove (file )
11+
12+ # Remove files ending with "testbench" in the current directory
13+ for file in glob .glob ("*testbench" ):
1214 os .remove (file )
1315
14- # remove all .txt, .cf, and .vcd files in the test directory
16+ # Remove files in " test" and its subdirectories
1517for root , dirs , files in os .walk ("test" ):
1618 for file in files :
17- if file .endswith (".txt" ) or file .endswith (".cf" ) or file . endswith ( ".vcd " ):
19+ if file .endswith (extensions ) or file .endswith ("testbench " ):
1820 os .remove (os .path .join (root , file ))
1921
20- print ("🧼 Cleaned up files!" )
22+ print ("🧼 Cleaned up files!" )
You can’t perform that action at this time.
0 commit comments