Skip to content

Commit cbd0225

Browse files
committed
added arrange files script
1 parent ce9eca5 commit cbd0225

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ However, with some modifications(/in some cases none) can be used in other field
1717
|[9: Heatmap](#9-heatmap)|[10: Pivot Table](#10-pivot-table)|[11: Generate ABN And ACN](#11-generate-abn-and-acn)|[12: Network Conversation Flow](#12-network-conversation-flow)|
1818
|[13: Creditcard Generator](#13-creditcard-generator)|[14: TFN Generator](#14-tfn-generator)|[15: IRD Generator](#15-ird-generator)|[16: Dollar Format](#16-dollar-format)|
1919
|[17: File Splitter](#17-file-splitter)|[18: Locate File](#18-locate-file)|[19: Websphere Verbosegc](#19-websphere-verbosegc)|[20: Formatted Server Metrics To Excel](#20-formatted-server-metrics-to-excel)|
20-
|[21: Merge Columns](#21-merge-columns)||||
20+
|[21: Merge Columns](#21-merge-columns)|[22: Arrange Files](#22-arrange-files)|||
2121
----
2222

2323
# [1: Merge Columns](#1-merge-columns)
@@ -145,6 +145,14 @@ Useful when you want to do analysis (i.e. Tukey test on the data set) using pyth
145145

146146
![Data](https://github.com/hseera/python-utilities/blob/main/images/merge-columns.png)
147147

148+
[22: Arrange Files](#22-arrange-files)
149+
This script arranges files in appropriate folders so it makes it easy to find them when needed.
150+
Useful when you want to have seperate folder for data, scripts, scenario & result.
151+
Also useful when you want to arrange all the files in your download folder which might have images, music, executable, video files.
152+
153+
![Data](https://github.com/hseera/python-utilities/blob/main/images/arrange-files.png)
154+
155+
148156
## Contribute
149157

150158
Contribution is welcomed. Pull requests are welcomed too.

arrange-files.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# -*- coding: utf-8 -*-
2+
"""
3+
This script iterates through all the JMeter files and arranges them in an appropriate folder.
4+
It will create folders if they don't exist.
5+
"""
6+
7+
import os
8+
import shutil
9+
10+
def search_file(folder_path):
11+
os.chdir(folder_path)
12+
files = os.listdir(os.getcwd())
13+
for filename in files:
14+
if not os.path.isdir(filename):
15+
print(filename)
16+
if filename.endswith('.jmx'): #jmeter scenario files
17+
if not os.path.exists('Scripts'):
18+
os.mkdir('Scripts')
19+
shutil.move(filename, 'Scripts')
20+
elif filename.endswith('.jtl'): #jmeter result files
21+
if not os.path.exists('Result'):
22+
os.mkdir('Result')
23+
shutil.move(filename, 'Result')
24+
elif filename.endswith(('.csv','.xls')): #jmeter data files
25+
if not os.path.exists('Data'):
26+
os.mkdir('Data')
27+
shutil.move(filename, 'Data')
28+
elif filename.endswith('.zip'): #any zip files
29+
if not os.path.exists('Zip_files'):
30+
os.mkdir('Zip_files')
31+
shutil.move(filename, 'Zip_files')
32+
else:
33+
continue # all other files, do nothing
34+
35+
def main():
36+
37+
FOLDER_PATH = "C:\\userxxx\\jmeter" #Change the folder path against which you want to run the script.
38+
search_file(FOLDER_PATH)
39+
40+
if __name__ == "__main__":
41+
main()

images/arrange-files.png

43.3 KB
Loading

responsetime_histogram.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
#parameters for the histogram. Update the values when you want to plot multiple histogram together
1919
#kwargs = dict(histtype='step', stacked=False, alpha=0.7, fill=False, bins=500)
20-
kwargs = dict(histtype='stepfilled', stacked=False, alpha=0.7, fill=True, bins=500)
20+
kwargs = dict(histtype='stepfilled', stacked=False, alpha=0.7, fill=True, bins=20000)
2121

2222
#define historgram label
2323
plt.xlabel('Response Time (ms)')

0 commit comments

Comments
 (0)