Felix K Posted February 3, 2020 Posted February 3, 2020 Hey Guys, I was wondering if there is a way to generate random file names when Batch Processing images. Greetings Quote
Staff Callum Posted February 3, 2020 Staff Posted February 3, 2020 Hi Felix K, There is no way to do this I'm afraid. Thanks C Quote Please tag me using @ in your reply so I can be sure to respond ASAP.
- S - Posted February 3, 2020 Posted February 3, 2020 I'm not sure what your use case is, however if what you want to do is just rename all the photos in a folder with random names, you could rename the files using PowerShell. The below script will rename all .tif and .tiff files that are in a Desktop folder called "Test", with random 8 digit alphanumeric (0-9, a-z) names. The -WhatIf switch parameter means it will give a simulated preview and will obviously need to be removed before it will actually rename any files. Make sure you test it is doing exactly what you want it to do before removing the -WhatIf switch parameter. # Path and length $Path = "$env:UserProfile\Desktop\Test" $Length = 8 # Run Get-ChildItem -Force -File -Path $Path | Where-Object { ($_.Extension -eq ".tif") -or ($_.Extension -eq ".tiff") } | ForEach-Object { $RandomName = -Join ( (48..57 + 97..122) * $Length | Get-Random -Count $Length | ForEach-Object { [char]$_ } ) Rename-Item -Path $_.FullName -NewName ("{0}{1}" -f $RandomName, $_.Extension) -WhatIf } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.