OK, so easy @superpunchypp
We need delete this 2 activity only, and edit some variable in next step, I will modify it then send to you in this evening (about 2 hours later)
Cheer
got it, do also add the other we discussed, if the value is similar, keep the first value and delete the second file that has same renamed, hence only keeping one and no duplicate
OK @superpunchypp ,
After test it success, I will sent to you
Cheer
Hi, any updates, thank you
Cheers
use Python to invoke the Python script to do this its so easy to do.
Use below Code:
import os
# Specify the folder path
folder_path = r'C:\Path\To\Your\Folder'
# List all files in the folder
files = os.listdir(folder_path)
# Iterate through the files in the folder
for file in files:
# Check if the file is a Word document (you can modify the condition accordingly)
if file.endswith('.docx'):
# Specify the old and new file paths
old_file_path = os.path.join(folder_path, file)
# Rename the file (replace 'Word' with the desired new name)
new_file_path = os.path.join(folder_path, file.replace('Word', 'NewName'))
# Perform the renaming
os.rename(old_file_path, new_file_path)
print(f"Renamed: {old_file_path} to {new_file_path}")
Make sure to replace 'Word'
with the actual part of the filename that you want to replace, and 'NewName'
with the desired new name.
If you dont know how to use python please check the below post I explain end to end and I given the python script and also I given Video for beginners
If you have any issues let me know.
Thanks,
Chethan P
but my project not allowed to use invoke code
Hi @superpunchypp ,
my new update
Rename (2).zip (710.9 KB)
regards,
how do i put a if statement before the rename file part to which if the so to be rename has already exist in the folder then dont rename that and go to the next?
Hi @superpunchypp ,
currentname = newname
cheer
which variable would be the currentname and newname
Hi @superpunchypp ,
The current name is file.toString
You can call the new name according to the renaming method I sent you in the previous source code
Cheer
is it ok if i send you my current process, I will send you a sample file to fix the current issue
ok, send it to me and I will fix it for you
Cheer
I sent, do let me know as soon as possible
Cheers
You need to use currentfile.name.equals(renamenewname)
Or
currentfile.name.Split("."c)(0).equals(renamenewname.Split("."c)(0))
Cheers
where do i put this in? can show in UiPath like a screenshot so i can do myself
you said drag if condition but where do i put this if condition at ?
You wnat the condition for rename…so place it at the point of rename…and move rename to the else side of if condition where ever you need
Cheers