DIR : /home/kozerus/public_html/mking/anyt.py
/home/kozerus/public_html/mking
# /Volumes/ka1tbr2/ht/mking/anyt.py
import os
import re
# Define the source directory
source_dir = "../../i"
# Define the destination directory
destination_dir = "/Volumes/ka1tbr2/ht/mking/anyt"
# Function to create directories if they don't exist
def create_directories():
if not os.path.exists(destination_dir):
# os.makedirs(destination_dir, mode=0755)
os.makedirs(destination_dir, mode=755)
return
# Check if source directory exists
if not os.path.exists(source_dir):
print(f"Error: Source directory '{source_dir}' does not exist.")
exit()
# Get list of files in the source directory
try:
files = os.listdir(source_dir)
except OSError:
print("Error: Could not list files in the source directory.")
exit()
# Filter and copy files starting with "anyt_"
file_list = []
for file in files:
# Check if filename starts with 'anyt_' using fnmatch
if re.match(r"anyt\._", file):
full_path = os.path.join(source_dir, file)
dest_full_path = os.path.join(destination_dir, file)
try:
# Copy the file
shutil.copy(full_path, destination_dir)
file_list.append(file)
except Exception as e:
print(f"Error: Failed to copy '{file}'.")
exit()
# Create the output text file
output_file = os.path.join(destination_dir, "anyt.txt")
with open(output_file, 'w') as f:
for file in file_list:
f.write(f"{file}\n")
print("All files starting with 'anyt_' have been copied and listed.")
//
koh5_pano
Drag mouse to navigate.
Navigation
- Left/Right Mouse drag: Changes camera heading.
- Up/Sown Mouse drag: Changes camera pitch.
- Scroll wheel: Changes camera field of view.
- I-Key: Displays Info panel with canvas size, image size and FPS.
17.Aug.2010, Martin Wengenmayer