LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Rename png file in bulk

Hi, I need help to programmatically rename png file in bulk with numbering 1,2,3, and so on using LabView. I only want to use number for the name of the pictures.

0 Kudos
Message 1 of 9
(1,665 Views)

Are they all in one folder or in an entire hierarchy?

 

You can use "list folder" or "recursive file list" with *.png as pattern, then process the files in a loop and moving the old name to the generated new name for each. Is there anything you need more detailed help?

 

Make sure you use the proper path tools and don't operate on full paths as strings. Only the filename operations should involve anything "pink".

 

How should the numbers be assigned? Based on alphabetical order? Based on creation date? Randomly?

 

If you turn names into numbers, I would also make sure to use a fixed number of decimal digits padded with zeroes (e.g. 001, 002, 002 ... 099 ... 234 ...) so alphabetical and numerical ordering is the same.

0 Kudos
Message 2 of 9
(1,659 Views)

You can use the "Move" function to rename files (Functions → Programming → File I/O → Adv File Funcs → Move)

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 3 of 9
(1,654 Views)

All  images are in one folder. I want it to be arranged based on time. The first one would be named as 1, next will be 2, and so on. I don't want any other character as shown below.

nursyfnz_0-1675960659405.png

 

0 Kudos
Message 4 of 9
(1,640 Views)

Are the current names such that if they are sorted by name they are also sorted by date or do we explicitly need to sort by the timestamp?

 

Would it be sufficient to create a new name that corresponds to the number inside the parentheses of the existing name? As I already said, you need to be careful with the sorting, because e.g. "12" would come alphabetically before "8".

0 Kudos
Message 5 of 9
(1,628 Views)

They are sorted by name they are also sorted by date. No, It is not sufficient to create a new name that corresponds to the number inside the parentheses of the existing name. You may ignore the number inside the parentheses as it is not sufficient. Just numbering 1,2,3... are needed.

0 Kudos
Message 6 of 9
(1,618 Views)

See if this can give you some idea.... (make a copy of the folder before testing, just to make sure....)

 

altenbach_0-1675962611343.png

 

 

altenbach_0-1675963271698.png

 

 

0 Kudos
Message 7 of 9
(1,596 Views)

For robustness, you might want to sort on the date:

sd.png

"If you weren't supposed to push it, it wouldn't be a button."
Message 8 of 9
(1,572 Views)

@nursyfnz wrote:

They are sorted by name they are also sorted by date. 


I agree with Paul that you still might want to sort by date, because windows explored does some mixed sorting that might not be fully alphabetical if the name also contains numbers.

 

The file list on the LabVIEW function will be fully alphabetical and might not agree with what you see in windows explorer.

0 Kudos
Message 9 of 9
(1,566 Views)