-
Notifications
You must be signed in to change notification settings - Fork 0
/
browser in folders.py
49 lines (39 loc) · 1.61 KB
/
browser in folders.py
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
47
48
49
import os
import shutil
import pyautogui
import time
# Define the folders
source_folder = r'C:\Brother'
destination_folder = r'C:\DCTF'
# Function to perform automation and file operations
def perform_operations():
try:
# Perform automation actions with pyautogui
pyautogui.click(x=50, y=41)
pyautogui.click(x=122, y=201)
pyautogui.click(x=1072, y=739)
pyautogui.click(x=953, y=733)
pyautogui.click(x=895, y=697)
time.sleep(2) # Add a short delay to ensure actions are completed
# List all .rfb files in source folder
files = os.listdir(source_folder)
# Create destination folder if it doesn't exist
os.makedirs(destination_folder, exist_ok=True)
# Copy .rfb files to destination folder
for file_name in files:
if file_name.endswith('.rfb'):
source_file_path = os.path.join(source_folder, file_name)
destination_file_path = os.path.join(destination_folder, file_name)
shutil.copy2(source_file_path, destination_file_path)
print(f"Copied: {file_name}")
# Delete .rfb files from source folder
for file_name in files:
if file_name.endswith('.rfb'):
file_path = os.path.join(source_folder, file_name)
os.remove(file_path)
print(f"Deleted: {file_name}")
print("Operations completed successfully.")
except Exception as e:
print(f"Error performing operations: {e}")
# Execute the operations
perform_operations()