I would like to rename each image with 10 digits of numbers.
For example:
For those images, I would like to rename as: 0000000001.png,0000000002.png, and 0000000003.png.
This is the reference for coding: http://askubuntu.com/questions/473236/renaming-hundreds-of-files-at-once-for-proper-sorting.
I am wondering if I can use Alteryx to rename those images.
Sincerely,
Kazumi
Solved! Go to Solution.
In the attached workflow, it uses a Directory toll to get the contents of a folder, then a formula tool to generate the new file name, and construct the command:
New FileName:
PadLeft([FileName], 14, "0")
Code:
'ren "'+[Directory]+[FileName]+'" "'+[New FileName]+'" echo '+[FileName]+','+[New FileName]
it then unions the text "echo off" to be the first record, Selects on the Code field, uses the Run Command tool to execute the generated commands, reads back in the list of name changes.
Hi @Joe_Mako,
It worked! Thank you!
I have a follow-up question:
I have an excel file which includes bulk of unique IDs (over 97,000 unique IDs).
Since those unique IDs do not have matched images, I would like to connect these unique IDs with "No Image Available" image below:
The disired result would be like this:
Do you think there is a way to do this using Alteryx?
Thank you,
Kazumi
If your "No image" image is called 0.jpg and is in the same directory as all the other images (with filename 1.jpg, 2.jpg, 3.jpg), and you have tour data source will a list of expected IDs:
0000000001
0000000002
0000000003
0000000004
0000000005
0000000006
then the attached workflow will rename the three known files, and copy/rename 0.jpg into the other three expected filenames.
Hi @Joe_Mako,
Thank you for your reply.
Unfortunately, I got no response when I used your workflow. It says that the system cannot find the file specified.
When I used my excel file that includes 97,000 unique IDs, I got another error, "The external program 'rename.bat' returned an error code: 1.
Do you know what's happening in this workflow?
Sincerely,
Kazumi
After running the workflow, I have 96,987 JPEG images in the folder. However, there are only 96,958 unique IDs in the excel file.
I checked if there are duplicated images, but there was no duplication. Are there any ways to check which JPEG images (29 images) are not linked to the unique IDs in the excel file?
Thank you,
Kazumi
My guess is those 29 records would come out of the Left output of the Join tool.
Hi @Joe_Mako,
Thank you, @Joe_Mako. There were 17 images from Left output of the join tool. I could see some of the names did not match due to the different image format (.png vs .jpg). I deleted duplicated images (.png vs .jpg) and I have 96,976 images now. There still have 18 unmatched images, but I will try to figure it out.
Sincerely,
Kazumi