Hi SoftwareRT,
from the code below, kindly insert a code validation if the file is exist then it prints file is already existing from the destination path.
===
# Create the destination directory if it doesn't exist
if not os.path.exists(dest_dir):
os.makedirs(dest_dir)...
Dear Gents,
Below code shows on how to copy the recent file from source to destination, and when I compiled it just only pops & nothing happens, kindly help and reencode. thanks.
src.dest202410150039728.txt <-- this file should be copied to the destination.
src.dest20241008012256.txt
========...
Hi,
I would like to display the last two digits of the year from the code below, please amend, thx
ystrday = date('s',(date('b')-1,'b')
CALL ZocSend "RE"||ystrday"||" ^M"
RE20240208
Am expecting a result of RE240208
Thank you mikrom for your suggestion, I segregated the path code, they are now opening using os.startfile() function, but the result of the os.startfile() is only in D:\tmp0\2024 & D:\tmp1\2024, the requirements will be pointed out directly inside the newly created folder, how's that? See snip...
Hi, from the highlighted function below am expecting an result of U:\tmp\2024\Feb 2024\2024-02-01\ & V:\tmp\2024\Feb 2024\2024-02-01\ but the output are only pointing in U:\tmp\ and V:\tmp\ folder separately , how do you declare?
print("Executing to create two folder directory namely :\n\n" +...
am trying to reencode with print function to show the two folders, but it will display only the V:\tmp folder, & another thing the os.startfile() function should open both folder after it was been successfully created, is that possible?
>>> paths = ["U:\\tmp\\", "V:\\tmp\\"]
>>> for path in...
what I mean is that, it will create a folder with different location/path, not in a subdirectory.
my_path0 = "U:\\tmp\\"
my_path1 = "V:\\tmp\\"
U:\tmp\2024\"Feb 2024"\2024-02-01
V:\tmp\2024\"Feb 2024"\2024-02-01
regards,
Hi mikrom,
From the code below, how to create same folder name in different path.
>>> from datetime import date, timedelta
>>> yesterday = date.today() - timedelta(days=1)
>>> current_time = yesterday.strftime('%Y\\"%b %Y\"\%Y-%m-%d')
>>> print(current_time)
2024\"Feb 2024"\2024-02-01
>>>...
Hi mikrom,
Yes the code is working so far, but the requirements doesn't met.
Scenario:
From the ZocRequest(Highlighted in Red) once the user pressed "Yes", the code exited instead it will loop again to
login = ZocAsk("What is your name:?"),
kindly add what am I missing. Thanks.
Hi am neophyte here, can you check the script below on how to declare loops in the conditional statement which start from the highlighted below.
Call ZocCls
login = ZocAsk(" What is your name:? ")
IF login = "##CANCEL##" THEN DO
answer = ZocRequest(" Command Cancelled , Retry?"...
Hi micron,
Highlighted below should automate the date everyday as a variable.
import os
def check_path(the_path):
if os.path.isdir(the_path):
print("path", the_path, "is a directory")
else:
print("path", the_path, "is not a directory !")
[highlight #FCE94F]my_path =...
Hi micron,
Are there any way to automate the date completely from my_path = "2024\\Jan_2024\\2024-01-11" not a string.
Example :
Today - 2024\Jan_2024\\2024-01-11
Tomorrow - 2024\Jan_2024\\2024-01-12
I appreciate your efforts.
Hi mikrom,
os.path.isdir(path)
os.path.exists(path)
how to insert/ declare that function on below code.
>>> current_time = yesterday.strftime('%Y\%b_%Y\%Y-%m-%d')
>>> print(current_time)
2024\Jan_2024\2024-01-11
>>> command = "mkdir {0}".format(current_time)
>>> print(command)
mkdir...
Dear Gents,
Below script creates a previous folder based on the date.
1. The question is how to go or open that folder automatically after it was been created.
2. How to create two folders with different drive or path based on the script below.
path = "G:" "H:"
current_time =...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.